X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1665389a9ab7359c164069a31f231f121e4afd8e..c9ed413ab4f5673ffff00198dc6ce1397398bda4:/src/osx/carbon/toolbar.cpp?ds=sidebyside diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index 58cc4af000..3d19290fc4 100644 --- a/src/osx/carbon/toolbar.cpp +++ b/src/osx/carbon/toolbar.cpp @@ -926,6 +926,12 @@ 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 ) @@ -937,6 +943,7 @@ wxToolBar::~wxToolBar() } CFRelease( (HIToolbarRef)m_macToolbar ); m_macToolbar = NULL; +#endif // wxOSX_USE_NATIVE_TOOLBAR } bool wxToolBar::Show( bool show ) @@ -1143,7 +1150,7 @@ void wxToolBar::MacUninstallNativeToolbar() { if (!m_macToolbar) return; - + WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef()); if (tlw) SetWindowToolbar( tlw, NULL ); @@ -1315,6 +1322,10 @@ bool wxToolBar::Realize() wxFAIL_MSG("Reference count of native tool was illegal before removal"); } wxASSERT( IsValidControlHandle(tool->GetControl()->GetPeer()->GetControlRef() )) ; + + wxString label = tool->GetLabel(); + if ( !label.empty() ) + HIToolbarItemSetLabel( hiItemRef, wxCFStringRef(label, GetFont().GetEncoding()) ); } }