First, I guess my Windows XP is broken, but I copy tim's built(which he build from win7) to another Windows XP computer, and I see the same crash there.
I build a wx3.0.2 release library which has debug information(has -g compiler option added)
Which shows some more detailed stack back trace, but still no idea where the crash come from:
Details are in a question I asked wx-user forum:
help: wired crash issue which only happens in Windows XP system with release build of wx 3.0.2.
While, the wx3.0.2 debug library works quite well(no crash here).
It looks like the bug are inside the Destroy() function of the whole GUI, which handling the AUI window. I have some test, if I put only two plugin dlls along with C::B, and in their OnAttach() function, I remove the code snippet:
CodeBlocksDockEvent evt(cbEVT_ADD_DOCK_WINDOW);
....
Manager::Get()->ProcessEvent(evt);
Then, I don't see the crash.
Second issue is that OnRelease code, I see some code just do this:
// remove tree from docking system
CodeBlocksDockEvent evt(cbEVT_REMOVE_DOCK_WINDOW);
evt.pWindow = m_pTree;
Manager::Get()->ProcessEvent(evt);
// finally destroy the tree
m_pTree->Destroy();
m_pTree = nullptr;
But this is not correct, because if the function parameter "appShutDown" is true, the "Manager::Get()->ProcessEvent(evt)" just dose nothing.
Third issue is how to remove the images created before the wxTree?
When in OnAttach(), we have:
m_pTree = new wxTreeCtrl();
...
m_pImages = new wxImageList(16, 16);
....
m_pTree->SetImageList(m_pImages);
But if the destroy of the wxTreeCtrl is done inside the Aui window system(as I said in second issue), what is the time to delete the m_pImages?