X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/efdb961d8f71daf6b482e2de33639997f4a6614b..02fd8b9b6186623ed61019ac7e69ed9a4ef16773:/samples/toolbar/toolbar.cpp?ds=sidebyside diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index 181d7188f1..c1c95e469b 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -332,6 +332,13 @@ void MyFrame::RecreateToolbar() wxToolBarBase *toolBar = GetToolBar(); long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE; + if (toolBar && m_searchTool && m_searchTool->GetToolBar() == NULL) + { + // see ~MyFrame() + toolBar->AddTool(m_searchTool); + } + m_searchTool = NULL; + delete toolBar; SetToolBar(NULL);