]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/toolbar.cpp
create stock GDI objects on demand; use const with GDI objects appropriately (patch...
[wxWidgets.git] / src / mac / carbon / toolbar.cpp
index f8fb57ce62501c18cb61c66654f4b3846d6d7b92..11fae3b2ff9f50df417110318d46062cbf035fa1 100644 (file)
@@ -80,8 +80,6 @@ public:
     ~wxToolBarTool()
     {
         ClearControl();
-        if ( m_controlHandle )
-            DisposeControl( m_controlHandle );
 
 #if wxMAC_USE_NATIVE_TOOLBAR
         if ( m_toolbarItemRef )
@@ -104,6 +102,11 @@ public:
     void ClearControl()
     {
         m_control = NULL;
+        if ( m_controlHandle )
+        {
+            DisposeControl( m_controlHandle );
+            m_controlHandle = NULL ;
+        }
 
 #if wxMAC_USE_NATIVE_TOOLBAR
         m_toolbarItemRef = NULL;
@@ -1310,8 +1313,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 )
                 {