X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/899544330f37440c140b72a014c518a911b5b7a4..5e9238f9c641b597bca67931ecb5896d7d835135:/src/gtk1/tbargtk.cpp diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 6b5a785f2c..f45f4e9112 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -489,12 +489,19 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) 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; + + default: + wxFAIL_MSG( "unknown tool style" ); + return false; } InvalidateBestSize();