Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swap two method calls to prevent a crash with the 10.12 SDK (#2609)
With this change we no longer KVObserve an object we aren’t interested in anymore and the -tabView:didCloseTabViewItem: method actually matches its name now (before it was more of a tabView:willCloseTabViewItem: method). Background: Normally the tab bar cell observes its delegate’s (SPDatabaseDocument) isProcessing property. Changes to this will trigger an async redraw of the tab view. The redrawing itself may involve a timer and a call to the tab view delegate (SPWindowController). Now, when the window is being closed this would cause the connection to close, which would affect the isProcessing property. However this time, when the timer is being fired the window controller would already be dealloc’d (since the tab bar delegate is unretained) causing a use-after-free crash. Previously -[PSMTabBarControl viewWillMoveToWindow:] stepped in at the right time and killed the timer before it could fire but on 10.12 the calls have shifted so the timer actually gets to fire and crash. This change solves the issue by not even letting the tab bar come to the point where it creates the problematic timer.
- Loading branch information
Showing with 5 additions and 2 deletions.