From a3e9caa2b55fcc62e0ac8262a45ee83d0c6ce453 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 16 Feb 2006 03:03:43 +0000 Subject: [PATCH 1/1] 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 --- src/common/tbarbase.cpp | 5 ++++- src/msw/tbar95.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) 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 -- 2.45.2