]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/tbargtk.cpp
Use t_str() instead of c_str()
[wxWidgets.git] / src / gtk1 / tbargtk.cpp
index 6b5a785f2c5a776edd7e0068b79c699d817e5466..f45f4e9112e1ce23112001c72d4cdba8c1f4e92c 100644 (file)
@@ -489,12 +489,19 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
     switch ( tool->GetStyle() )
     {
         case wxTOOL_STYLE_CONTROL:
     switch ( tool->GetStyle() )
     {
         case wxTOOL_STYLE_CONTROL:
-            tool->GetControl()->Destroy();
+            // don't destroy the control here as we can be called from
+            // RemoveTool() and then we need to keep the control alive;
+            // while if we're called from DeleteTool() the control will
+            // be destroyed when wxToolBarToolBase itself is deleted
             break;
 
         case wxTOOL_STYLE_BUTTON:
             gtk_widget_destroy( tool->m_item );
             break;
             break;
 
         case wxTOOL_STYLE_BUTTON:
             gtk_widget_destroy( tool->m_item );
             break;
+
+        default:
+            wxFAIL_MSG( "unknown tool style" );
+            return false;
     }
 
     InvalidateBestSize();
     }
 
     InvalidateBestSize();