From 10b7d587fac8c15a9234792ba8925f63fc14f28e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 1 Jun 2014 16:23:15 +0000 Subject: [PATCH] Don't recreate the native control in wxOSX wxDataViewCtrl dtor. Don't call ClearColumns() which recreates the control in order to remove its columns in wxOSX/Cocoa, just clean up the internal data, the control, and its columns, will soon be deleted anyhow. Closes #16210. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76639 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/dataview_osx.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osx/dataview_osx.cpp b/src/osx/dataview_osx.cpp index f11bc3de42..c220cdb76c 100644 --- a/src/osx/dataview_osx.cpp +++ b/src/osx/dataview_osx.cpp @@ -349,7 +349,12 @@ void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr) wxDataViewCtrl::~wxDataViewCtrl() { - ClearColumns(); + // Notice that we don't call ClearColumns() from here as with Cocoa this + // method actually recreates the entire control which is unnecessary when + // we're about to dsetroy it and results in unexpected side effects (e.g. + // calls to comparison function as the entire contents of the control is + // re-added to it and so possibly re-sorted). + WX_CLEAR_ARRAY(m_ColumnPtrs); // Ensure that the already destructed controls is not notified about changes // in the model any more.