X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3025abca059bd3686b5bf642382a970988d5ef7a..0d1c8f39baaaeb7a7f757091209eab471ef5dbc4:/src/mac/carbon/toolbar.cpp diff --git a/src/mac/carbon/toolbar.cpp b/src/mac/carbon/toolbar.cpp index f8fb57ce62..b4702c6daf 100644 --- a/src/mac/carbon/toolbar.cpp +++ b/src/mac/carbon/toolbar.cpp @@ -13,10 +13,12 @@ #if wxUSE_TOOLBAR -#include "wx/wx.h" -#include "wx/bitmap.h" #include "wx/toolbar.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + #include "wx/mac/uma.h" #include "wx/geometry.h" @@ -80,8 +82,6 @@ public: ~wxToolBarTool() { ClearControl(); - if ( m_controlHandle ) - DisposeControl( m_controlHandle ); #if wxMAC_USE_NATIVE_TOOLBAR if ( m_toolbarItemRef ) @@ -104,6 +104,11 @@ public: void ClearControl() { m_control = NULL; + if ( m_controlHandle ) + { + DisposeControl( m_controlHandle ); + m_controlHandle = NULL ; + } #if wxMAC_USE_NATIVE_TOOLBAR m_toolbarItemRef = NULL; @@ -904,7 +909,7 @@ bool wxToolBar::Realize() if (err != noErr) { wxString errMsg = wxString::Format( wxT("HIToolbarRemoveItemAtIndex failed [%ld]"), (long)err ); - wxASSERT_MSG( 0, errMsg.c_str() ); + wxFAIL_MSG( errMsg.c_str() ); } } @@ -912,7 +917,7 @@ bool wxToolBar::Realize() if (err != noErr) { wxString errMsg = wxString::Format( wxT("HIToolbarInsertItemAtIndex failed [%ld]"), (long)err ); - wxASSERT_MSG( 0, errMsg.c_str() ); + wxFAIL_MSG( errMsg.c_str() ); } tool->SetIndex( currentPosition ); @@ -1262,7 +1267,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) else { wxString errMsg = wxString::Format( wxT("wxToolBar::DoInsertTool - failure [%ld]"), (long)err ); - wxASSERT_MSG( false, errMsg.c_str() ); + wxFAIL_MSG( errMsg.c_str() ); } return (err == noErr); @@ -1310,8 +1315,6 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase) case wxTOOL_STYLE_SEPARATOR: if ( tool->GetControlHandle() ) { - DisposeControl( (ControlRef) tool->GetControlHandle() ); - #if wxMAC_USE_NATIVE_TOOLBAR if ( removeIndex != -1 && m_macHIToolbarRef ) {