From 2be8287edffc1f34fa994ee9c39123654f1e92c8 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 21 Mar 2024 02:00:44 +1000 Subject: [PATCH] Qt: Fix closing log window via taskbar --- src/duckstation-qt/logwindow.cpp | 8 ++++++++ src/duckstation-qt/logwindow.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/duckstation-qt/logwindow.cpp b/src/duckstation-qt/logwindow.cpp index 514346de0a..7b7831e9c9 100644 --- a/src/duckstation-qt/logwindow.cpp +++ b/src/duckstation-qt/logwindow.cpp @@ -59,6 +59,7 @@ void LogWindow::updateSettings() } else if (g_log_window) { + g_log_window->m_destroying = true; g_log_window->close(); g_log_window->deleteLater(); g_log_window = nullptr; @@ -70,6 +71,7 @@ void LogWindow::destroy() if (!g_log_window) return; + g_log_window->m_destroying = true; g_log_window->close(); g_log_window->deleteLater(); g_log_window = nullptr; @@ -306,6 +308,12 @@ void LogWindow::logCallback(void* pUserParam, const char* channelName, const cha void LogWindow::closeEvent(QCloseEvent* event) { + if (!m_destroying) + { + event->ignore(); + return; + } + Log::UnregisterCallback(&LogWindow::logCallback, this); saveSize(); diff --git a/src/duckstation-qt/logwindow.h b/src/duckstation-qt/logwindow.h index e9d3b0efc2..d6054d940d 100644 --- a/src/duckstation-qt/logwindow.h +++ b/src/duckstation-qt/logwindow.h @@ -55,6 +55,7 @@ private Q_SLOTS: std::span m_filter_names; bool m_attached_to_main_window = true; + bool m_destroying = false; }; extern LogWindow* g_log_window;