My application needs to create or to delete wxAuiToolBar objects on the fly depending on the current status of the application.
Some toolbars are connected to wxUpdateUIEvent to ease the way buttons are enabled or disabled.
When I want to remove and free the memory allocated to a wxAuiToolBar object, I use the following code:
- Code: Select all
m_pAuiManager->GetPane(m_pAuiToolBar).Hide();
m_pAuiManager->DetachPane(m_pAuiToolBar);
m_pAuiToolBar->Destroy();
This code works fine on condition that the toolbar is not floating or is not connected to some wxUpdateUIEvents ; otherwise I get a segfault (at least on GTK). If the toolbar is docked, there is no problem, whatever wxUpdateUIEvents are connected or not.
I tried to disable the toolbar's event handler with
- Code: Select all
m_pAuiToolBar->SetEvtHandlerEnable(false)
Any ideas?
Thank you very much in advance!
Florent