From: Robin Dunn Date: Thu, 16 Feb 2006 03:03:43 +0000 (+0000) Subject: Fix for Bug #1432054: ToolBar controls not removed by ClearTools X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a3e9caa2b55fcc62e0ac8262a45ee83d0c6ce453?hp=3b6a1179621302e72f6d563d87aa2eabf1d8ce5d Fix for Bug #1432054: ToolBar controls not removed by ClearTools 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 --- diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 6f94c924cc..85f121426b 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -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() diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 43a159862d..1dd377605c 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -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