Fixed crash caused by exception in SetWindow ctor

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1019 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-07-09 23:03:29 +00:00
parent a0e0ab7149
commit 684de303e0
+11 -1
View File
@@ -162,7 +162,17 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
SetExtraStyle(wxWS_EX_PROCESS_UI_UPDATES);
tabBar->SetExtraStyle(wxWS_EX_PROCESS_UI_UPDATES);
setSet(set);
try {
setSet(set);
} catch (...) {
// clean up!
// if we don't destroy the panel we could crash in ~CardsPanel, since it expected
// the insertSymbolMenu to be removed by destroyUI but not deleted.
current_panel->destroyUI(GetToolBar(), GetMenuBar());
delete find_dialog;
set_windows.erase(remove(set_windows.begin(), set_windows.end(), this));
throw;
}
current_panel->Layout();
}