From ed4446ae769f333e9e8034ca0f144d2a9fe255b6 Mon Sep 17 00:00:00 2001 From: Soner YUKSEL Date: Tue, 25 Jul 2023 12:15:51 -0400 Subject: [PATCH] Fix brave/brave-ios#7737: Crash at Browsing Mode Change while drag-drop action in Tab Tray (brave/brave-ios#7778) Adding check for active drag and drop while mode change --- .../Frontend/Browser/Tabs/TabTray/TabTrayController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift b/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift index af6005e341b3..e5cd30b65d64 100644 --- a/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift +++ b/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift @@ -588,6 +588,12 @@ class TabTrayController: LoadingViewController { @objc func togglePrivateModeAction() { tabTraySearchController.isActive = false + + // Mode Change action disabled while drap-drop is active + // Added to prevent Diffable Data source crash + if tabTrayView.collectionView.hasActiveDrag || tabTrayView.collectionView.hasActiveDrop { + return + } // Record the slected index before private mode navigation if !privateMode {