From f08d1826bba55d33cbf8cf8de2ce4cccd1592c8e Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sat, 13 Jan 2024 22:58:44 +0100 Subject: [PATCH] fix: ignore save requests after closing all windows --- src/singletons/WindowManager.cpp | 12 +++++++++++- src/singletons/WindowManager.hpp | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index d2f8295bb..49889f7fc 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -422,7 +422,14 @@ void WindowManager::save() { return; } - qCDebug(chatterinoWindowmanager) << "[WindowManager] Saving"; + + if (this->shuttingDown_) + { + qCDebug(chatterinoWindowmanager) << "Skipping save (shutting down)"; + return; + } + + qCDebug(chatterinoWindowmanager) << "Saving"; assertInGuiThread(); QJsonDocument document; @@ -701,6 +708,9 @@ void WindowManager::closeAll() { assertInGuiThread(); + qCDebug(chatterinoWindowmanager) << "Shutting down (closing windows)"; + this->shuttingDown_ = true; + for (Window *window : windows_) { window->close(); diff --git a/src/singletons/WindowManager.hpp b/src/singletons/WindowManager.hpp index 22a68655c..4e3ed7d37 100644 --- a/src/singletons/WindowManager.hpp +++ b/src/singletons/WindowManager.hpp @@ -140,6 +140,7 @@ private: const QString windowLayoutFilePath; bool initialized_ = false; + bool shuttingDown_ = false; QPoint emotePopupPos_;