X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/07d02e9ee0fe990aeb81e152a668d0011659b5c7..94f0292941b6520afbabc999da698ef5fe576a46:/src/gtk1/tbargtk.cpp diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 462561c522..9924462303 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -125,7 +125,7 @@ public: if (bitmap.Ok()) { GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap() - : (GdkBitmap *)NULL; + : NULL; gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask ); } } @@ -230,7 +230,7 @@ static void wxInsertChildInToolBar( wxToolBar* WXUNUSED(parent), void wxToolBarTool::Init() { m_item = - m_pixmap = (GtkWidget *)NULL; + m_pixmap = NULL; } wxToolBarToolBase *wxToolBar::CreateTool(int id, @@ -258,7 +258,7 @@ wxToolBar::CreateTool(wxControl *control, const wxString& label) void wxToolBar::Init() { - m_toolbar = (GtkToolbar *)NULL; + m_toolbar = NULL; m_blockEvent = false; m_defaultWidth = 32; m_defaultHeight = 32; @@ -366,11 +366,11 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) wxCHECK_MSG( bitmap.GetPixmap() != NULL, false, wxT("wxToolBar::Add needs a wxBitmap") ); - GtkWidget *tool_pixmap = (GtkWidget *)NULL; + GtkWidget *tool_pixmap = NULL; GdkPixmap *pixmap = bitmap.GetPixmap(); - GdkBitmap *mask = (GdkBitmap *)NULL; + GdkBitmap *mask = NULL; if ( bitmap.GetMask() ) mask = bitmap.GetMask()->GetBitmap(); @@ -482,19 +482,26 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) return true; } -bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase) +bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) { wxToolBarTool *tool = (wxToolBarTool *)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(); @@ -549,7 +556,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x), // VZ: GTK+ doesn't seem to have such thing wxFAIL_MSG( _T("wxToolBar::FindToolForPosition() not implemented") ); - return (wxToolBarToolBase *)NULL; + return NULL; } void wxToolBar::SetMargins( int x, int y )