This commit is contained in:
forsen
2025-07-17 21:36:45 +02:00
parent 09fc5d74bc
commit fec20d3f3b
2 changed files with 12 additions and 4 deletions
+5
View File
@@ -607,6 +607,8 @@ void Application::aboutToQuit()
this->hotkeys->save();
this->windows->save();
this->windows->closeAll();
}
void Application::stop()
@@ -664,6 +666,9 @@ void Application::initNm(const Paths &paths)
IApplication *getApp()
{
assert(INSTANCE != nullptr);
if (STOPPED.load() == true) {
__debugbreak();
}
assert(STOPPED.load() == false);
return INSTANCE;
+7 -4
View File
@@ -151,12 +151,15 @@ bool Window::event(QEvent *event)
return BaseWindow::event(event);
}
void Window::closeEvent(QCloseEvent *)
void Window::closeEvent(QCloseEvent *event)
{
auto *app = tryGetApp();
assert(app != nullptr);
if (this->type_ == WindowType::Main)
{
getApp()->getWindows()->save();
getApp()->getWindows()->closeAll();
app->getWindows()->save();
app->getWindows()->closeAll();
}
else
{
@@ -167,7 +170,7 @@ void Window::closeEvent(QCloseEvent *)
// Ensure selectedWindow_ is never an invalid pointer.
// WindowManager will return the main window if no window is pointed to by
// `selectedWindow_`.
getApp()->getWindows()->selectedWindow_ = nullptr;
app->getWindows()->selectedWindow_ = nullptr;
this->closed.invoke();