From a747886323c9aab201777ff3085bfa1e204f7916 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Thu, 30 May 2019 19:46:09 -0400 Subject: [PATCH] Exit when receiving OS Close Message when in tray * Fixes #2692 * KeePassXC was ignoring OS close messages on shutdown or logoff when minimize to tray on close was enabled. This change causes a second close message (when KeePassXC is hidden to the tray) to actually exit the application. --- src/gui/MainWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 3127fe046..334d4fed1 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -874,7 +874,9 @@ void MainWindow::closeEvent(QCloseEvent* event) return; } - if (config()->get("GUI/MinimizeOnClose").toBool() && !m_appExitCalled) { + // Don't ignore close event when the app is hidden to tray. + // This can occur when the OS issues close events on shutdown. + if (config()->get("GUI/MinimizeOnClose").toBool() && !isHidden() && !m_appExitCalled) { event->ignore(); hideWindow(); return;