From 015d53355627924d1c219cb19ca61b751bb7b745 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 16 May 2012 14:23:16 +0000 Subject: [PATCH] Fix bad destruction order when exiting without closing the main window first On OS X, when closing via Quit the document windows are not closed until after OnExit is called, resulting the project context being destructed after the global stuff, resulting in crashes on exit in some cases. Originally committed to SVN as r6812. --- aegisub/src/frame_main.cpp | 2 ++ aegisub/src/main.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index ca4033fdd..cab5693a2 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -249,6 +249,8 @@ static bool delete_children(wxWindow *window, wxWindow *keep) { } FrameMain::~FrameMain () { + wxGetApp().frame = 0; + context->videoController->SetVideo(""); context->audioController->CloseAudio(); diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 1718289ef..858ae824b 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -292,6 +292,9 @@ bool AegisubApp::OnInit() { /// @return /// int AegisubApp::OnExit() { + if (frame) + delete frame; + if (wxTheClipboard->Open()) { wxTheClipboard->Flush(); wxTheClipboard->Close();