From 43f461e8464da3b8b739e1c5fcd17b1c9b36d6af Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 11 Mar 2012 23:04:49 +0000 Subject: [PATCH] Delete the dialog manager before the main frame as having modeless dialogs disappear after the main window is ugly Originally committed to SVN as r6563. --- aegisub/src/frame_main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index c9bd8e4d6..aca6df4ae 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -223,8 +223,6 @@ FrameMain::FrameMain (wxArrayString args) } FrameMain::~FrameMain () { - delete context->dialog; - // Because the subs grid is the selection controller, it needs to stay // alive significantly longer than the other child controls SubsGrid->Reparent(0); @@ -566,16 +564,18 @@ void FrameMain::OnCloseWindow (wxCloseEvent &event) { // Ask user if he wants to save first bool canVeto = event.CanVeto(); int result = TryToCloseSubs(canVeto); + if (canVeto && result == wxCANCEL) { + event.Veto(); + return; + } + + delete context->dialog; + context->dialog = 0; // Store maximization state OPT_SET("App/Maximized")->SetBool(IsMaximized()); - // Abort/destroy - if (canVeto) { - if (result == wxCANCEL) event.Veto(); - else Destroy(); - } - else Destroy(); + Destroy(); } void FrameMain::OnAutoSave(wxTimerEvent &) try {