X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22756322824e8f377b792897209d052ca9281534..ec2df34e27ba41f202ecbf096cdfed082a9ddb8f:/src/osx/carbon/toolbar.cpp diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index f0576260c5..093c703000 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 ) @@ -1111,7 +1120,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) // which we don't want in this case wxSize sz = GetParent()->GetSize(); ShowHideWindowToolbar( tlw, true, false ); - // Restore the orginal size + // Restore the original size GetParent()->SetSize( sz ); ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 );