Skip to content

Commit 013f1b2

Browse files
committed
#3651 macos: attempt to fix app closing issue
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent c72f8af commit 013f1b2

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# QOwnNotes Changelog
22

3+
## 26.6.12
4+
5+
- Fixed quitting QOwnNotes on **macOS** when the menu bar item is enabled, so the
6+
application no longer minimizes back to the menu bar during quit or session
7+
shutdown and blocks shutting down the Mac (for [#3651](https://github.com/pbek/QOwnNotes/issues/3651))
8+
39
## 26.6.11
410

511
- Fixed the Qt 5 Ubuntu Launchpad release container by pinning it to Ubuntu

src/mainwindow.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
596596
connect(qApp, &QApplication::commitDataRequest, this, &MainWindow::on_action_Quit_triggered);
597597
#else
598598
// Avoid re-entering the Cocoa quit flow on macOS during session shutdown, see #3546.
599+
// Still mark shutdown so closeEvent doesn't minimize to the menu bar item and block logout.
600+
connect(qApp, &QApplication::commitDataRequest, this,
601+
[] { qApp->setProperty("appIsShuttingDown", true); });
599602
#endif
600603

601604
// Register the LogWidget::LogType type so showStatusBarMessage there doesn't throw a warning,
@@ -3619,7 +3622,8 @@ void MainWindow::storeSettings() {
36193622

36203623
void MainWindow::closeEvent(QCloseEvent *event) {
36213624
const bool forceQuit = qApp->property("clearAppDataAndExit").toBool();
3622-
const bool isJustHide = showSystemTray;
3625+
const bool isAppShuttingDown = qApp->property("appIsShuttingDown").toBool();
3626+
const bool isJustHide = showSystemTray && !isAppShuttingDown;
36233627

36243628
#ifdef Q_OS_MAC
36253629
// #1113, unfortunately the closeEvent is also fired when the application

0 commit comments

Comments
 (0)