From ead12de8b65b33e0b9c00b3f0f88d1655ab2fe7b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 30 Aug 2015 18:18:07 -0700 Subject: [PATCH] Actually close all windows on quit --- src/command/app.cpp | 4 ++-- src/main.cpp | 7 +++++++ src/main.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/command/app.cpp b/src/command/app.cpp index 598cb9b5d..edd27bdab 100644 --- a/src/command/app.cpp +++ b/src/command/app.cpp @@ -145,8 +145,8 @@ struct app_exit final : public Command { STR_DISP("Exit") STR_HELP("Exit the application") - void operator()(agi::Context *c) override { - c->frame->Close(); + void operator()(agi::Context *) override { + wxGetApp().CloseAll(); } }; diff --git a/src/main.cpp b/src/main.cpp index af299715e..7227d0877 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -379,6 +379,13 @@ agi::Context& AegisubApp::NewProjectContext() { return *frame->context; } +void AegisubApp::CloseAll() { + for (auto frame : frames) { + if (!frame->Close()) + break; + } +} + void AegisubApp::UnhandledException(bool stackWalk) { #if (!defined(_DEBUG) || defined(WITH_EXCEPTIONS)) && (wxUSE_ON_FATAL_EXCEPTION+0) bool any = false; diff --git a/src/main.h b/src/main.h index d69dc2c1e..de65b65da 100644 --- a/src/main.h +++ b/src/main.h @@ -63,6 +63,7 @@ public: AegisubLocale locale; agi::Context& NewProjectContext(); + void CloseAll(); // Apple events void MacOpenFiles(wxArrayString const& filenames)