From 71940de69327007b5ac55aa8dc45221599744bef Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 5 May 2012 05:32:19 +0000 Subject: [PATCH] fixes crashes with embedded controls in toolbars after toolbar destruction, code was moved in r62988, but apparently Destroy doesn't have to be called, so do a last check, fixes #14258 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71364 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/toolbar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index f0576260c5..0f3944c373 100644 --- a/src/osx/carbon/toolbar.cpp +++ b/src/osx/carbon/toolbar.cpp @@ -932,6 +932,15 @@ wxToolBar::~wxToolBar() if ( !m_macToolbar ) return; + // it might already have been uninstalled due to a previous call to Destroy, but in case + // wasn't, do so now, otherwise redraw events may occur for deleted objects + bool ownToolbarInstalled = false; + MacTopLevelHasNativeToolbar( &ownToolbarInstalled ); + if (ownToolbarInstalled) + { + MacUninstallNativeToolbar(); + } + CFIndex count = CFGetRetainCount( m_macToolbar ) ; // Leopard seems to have one refcount more, so we cannot check reliably at the moment if ( UMAGetSystemVersion() < 0x1050 ) -- 2.45.2