From 684de303e05319827a9a406dfadb4964f7d8a0e3 Mon Sep 17 00:00:00 2001 From: twanvl Date: Wed, 9 Jul 2008 23:03:29 +0000 Subject: [PATCH] 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 --- src/gui/set/window.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index 5ad9c3d7..f8c41b65 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -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(); }