I'm trying to create an application based on the MDI doc-view paradigm.
The application starts up with an empty window and the toolbar.
When the user click on one of the tools in the toolbar the MDI child window with the view is created and the user goes thru some modal dialogs.
Based on the user responce in those dialogs I am changing the layout of the view and changing the menu bar/toolbar.
So basically I am calling this:
Code: Select all
wxMenuBar *menuBar = dynamic_cast<MDIParentFrame *>( GetMainWindow() )->GetMenuBar();
for( size_t i = menuBar->GetCount() - 2; i > 0; --i )
{
auto *menu = menuBar->Remove( i );
delete menu;
menu = nullptr;
}
menuBar->Insert( 1, <new menu> );
So, this is what happens.
Initially I have a menu bar like this:
After executing the code above it becomes:File <menu1> <menu2> <menu3> Windows Help
Now the sample does not assign the menu pointer to become "nullptr" after deletion.File <menu4> Windows Help
Could this be a culprit?
Thank you.