Skip to content

Commit 292bb06

Browse files
committed
Address main-thread sanitizer issue: change tab bar index on main thread
1 parent af7db0e commit 292bb06

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

WordPress/Classes/System/Root View/WPTabBarController+RootViewPresenter.swift

+7-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ extension WPTabBarController: RootViewPresenter {
2222
}
2323

2424
func showNotificationsTab(completion: ((NotificationsViewController) -> Void)?) {
25-
self.selectedIndex = WPTab.notifications.rawValue
26-
completion?(self.notificationsViewController!)
25+
// UITabBarController.selectedIndex must be used from main thread only.
26+
DispatchQueue.main.async { [weak self] in
27+
guard let self else { return }
28+
29+
self.selectedIndex = WPTab.notifications.rawValue
30+
completion?(self.notificationsViewController!)
31+
}
2732
}
2833

2934
// MARK: Me

0 commit comments

Comments
 (0)