From 19b3adeb962de0fa3f6c6746c0261548144d90ba Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 27 Sep 2024 18:13:38 +0200 Subject: [PATCH] MainWindow: Keep running require system tray icon Fixes bug where Strawberry remains running when system tray icon is disabled. --- src/core/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 8a85fd07e..c16014f1f 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -1107,10 +1107,10 @@ void MainWindow::ReloadSettings() { constexpr bool keeprunning_available = true; #else const bool systemtray_available = tray_icon_->IsSystemTrayAvailable(); - const bool keeprunning_available = systemtray_available; s.beginGroup(BehaviourSettingsPage::kSettingsGroup); const bool showtrayicon = s.value("showtrayicon", systemtray_available).toBool(); s.endGroup(); + const bool keeprunning_available = systemtray_available && showtrayicon; if (systemtray_available) { tray_icon_->setVisible(showtrayicon); } @@ -1642,7 +1642,7 @@ void MainWindow::closeEvent(QCloseEvent *e) { } if (!exit_) { - if (!hidden_ && keep_running_ && tray_icon_->IsSystemTrayAvailable()) { + if (!hidden_ && tray_icon_->IsSystemTrayAvailable() && tray_icon_->isVisible() && keep_running_) { SetHiddenInTray(true); } else {