From 3cd3739570ae08024c520adda9bd466a883cebaf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 2 Mar 2010 18:16:11 +0000 Subject: [PATCH] Don't use m_macToolbar in wxOSX wxToolBar if it is NULL. This fixes a crash when a native toolbar is not used by wxToolBar as it happens when it's used by wxToolbook for example. Closes #11775. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63604 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/toolbar.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index ca9c011d89..f3a127ab46 100644 --- a/src/osx/carbon/toolbar.cpp +++ b/src/osx/carbon/toolbar.cpp @@ -927,6 +927,11 @@ bool wxToolBar::Create( wxToolBar::~wxToolBar() { #if wxOSX_USE_NATIVE_TOOLBAR + // We could be not using a native tool bar at all, this happens when we're + // created with something other than the frame as parent for example. + if ( !m_macToolbar ) + return; + CFIndex count = CFGetRetainCount( m_macToolbar ) ; // Leopard seems to have one refcount more, so we cannot check reliably at the moment if ( UMAGetSystemVersion() < 0x1050 ) -- 2.47.2