From c515c43fd59c51d9df3afd9b07f3b4dcca11892d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Thu, 21 Sep 2017 13:54:05 +0200 Subject: [PATCH] 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. --- src/osx/cocoa/dataview.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 457bb3b140..b5664ac2fa 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -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];