Fix wxDataViewCtrl::ClearColumns() crash on macOS 10.13
When replacing m_OutlineView with a new one in ClearColumns(), we must explicitly remove the old one from its superview to ensure that no more drawing operations are pending for it. Without this change, Cocoa drawing code would occasionally crash on attempting to message the now-zombie m_OutlineView instance. This happened in older macOS versions too, but became much more frequent in 10.13 High Sierra.
This commit is contained in:
@@ -2089,6 +2089,8 @@ bool wxCocoaDataViewControl::ClearColumns()
|
||||
// columns cannot be deleted if there is an outline column in the view;
|
||||
// therefore, the whole view is deleted and newly constructed:
|
||||
RemoveAssociation(m_OutlineView); // undo InitOutlineView's association
|
||||
|
||||
[m_OutlineView removeFromSuperviewWithoutNeedingDisplay];
|
||||
[m_OutlineView release];
|
||||
m_OutlineView = [[wxCocoaOutlineView alloc] init];
|
||||
[((NSScrollView*) GetWXWidget()) setDocumentView:m_OutlineView];
|
||||
|
Reference in New Issue
Block a user