]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix for Bug #1432054: ToolBar controls not removed by ClearTools
authorRobin Dunn <robin@alldunn.com>
Thu, 16 Feb 2006 03:03:43 +0000 (03:03 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 16 Feb 2006 03:03:43 +0000 (03:03 +0000)
Use DeleteTool in ClearTools instead of just destroying the internal
list, so the toolbar is kept fully in sync with the removal of all
tool types.  Also fix wxMSW version to actually Destroy() the controls
when they are deleted from the toolbar.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/tbarbase.cpp
src/msw/tbar95.cpp

index 6f94c924cc8c75669be35aadbb483b1d1d24fe24..85f121426b495034579917a51822c4d0d1dcc240 100644 (file)
@@ -409,7 +409,10 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool)
 
 void wxToolBarBase::ClearTools()
 {
-    WX_CLEAR_LIST(wxToolBarToolsList, m_tools);
+    while ( GetToolsCount() )
+    {
+        DeleteToolByPos(0);
+    }
 }
 
 bool wxToolBarBase::Realize()
index 43a159862d3ec6056a17495b95586ea694cdda34..1dd377605c37604e58d946397e8937ca024e938b 100644 (file)
@@ -455,6 +455,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
     {
         nButtonsToDelete = ((wxToolBarTool *)tool)->GetSeparatorsCount();
         width *= nButtonsToDelete;
+        tool->GetControl()->Destroy();
     }
 
     // do delete all buttons