The function void MainFrame::OnPluginUnloaded(CodeBlocksEvent& event) will be called when you "disable" a plugin in the "Manage plugins dialog", the function mainly remove the plugin's toolbar and status bar field. We have:
m->RegisterEventSink(cbEVT_PLUGIN_RELEASED, new cbEventFunctor<MainFrame, CodeBlocksEvent>(this, &MainFrame::OnPluginUnloaded));
In function: void MainFrame::RegisterEvents().
But I found that when C::B exit, I mean you click the "close" button of the Mainframe, this function(MainFrame::OnPluginUnloaded) does not be called, to reproduce this, you can simply set a bp in the MainFrame::OnPluginUnloaded function body, then start debugging C::B, then just close debugee C::B, you will notice that this bp does not hit, because C::B event pumping engine only works when app is
not shutting down.
bool Manager::ProcessEvent(CodeBlocksEvent& event)
{
if (IsAppShuttingDown())
return false;
EventSinksMap::iterator mit = m_EventSinks.find(event.GetEventType());
if (mit != m_EventSinks.end())
{
for (EventSinksArray::iterator it = mit->second.begin(); it != mit->second.end(); ++it)
(*it)->Call(event);
}
return true;
}
So my question is: Do we need a function in MainFrame class to take the duty? (Destroy all the toolbars and status?) Maybe, it is not necessary, because wx framework can clean those UIs, but refer to this post:
Re: Toggle toolbar by context menu?, I do want to find a chance to disconnect the event handler for those toolbars.
Another question is: We have a function: void MainFrame::RegisterEvents() which register event, but we don't have an un-do function to unregister them, are they needed?