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.
This commit is contained in:
Thomas Goyne 2012-05-16 14:23:16 +00:00
parent 7ab4f85211
commit 015d533556
2 changed files with 5 additions and 0 deletions

View File

@ -249,6 +249,8 @@ static bool delete_children(wxWindow *window, wxWindow *keep) {
}
FrameMain::~FrameMain () {
wxGetApp().frame = 0;
context->videoController->SetVideo("");
context->audioController->CloseAudio();

View File

@ -292,6 +292,9 @@ bool AegisubApp::OnInit() {
/// @return
///
int AegisubApp::OnExit() {
if (frame)
delete frame;
if (wxTheClipboard->Open()) {
wxTheClipboard->Flush();
wxTheClipboard->Close();