wxToolBarToolBase::~wxToolBarToolBase()
{
delete m_dropdownMenu;
+ if ( IsControl() )
+ GetControl()->Destroy();
}
}
m_tools.Insert(pos, tool);
+ tool->Attach(this);
return tool;
}
{
// don't give any error messages - sometimes we might call RemoveTool()
// without knowing whether the tool is or not in the toolbar
- return (wxToolBarToolBase *)NULL;
+ return NULL;
}
wxToolBarToolBase *tool = node->GetData();
+ wxCHECK_MSG( tool, NULL, "NULL tool in the tools list?" );
+
if ( !DoDeleteTool(pos, tool) )
- {
- return (wxToolBarToolBase *)NULL;
- }
+ return NULL;
m_tools.Erase(node);
+ tool->Detach();
+
return tool;
}