Skip to content

Commit e54a4de

Browse files
john-moffetthebasto
authored andcommitted
Fixes #26490 by preventing notifications
MacOS 13 sends a window focus change notification after the main window has been destroyed but before the QTApplication has been destroyed. This results in the menu bar receiving a notification despite it no longer existing. The solution is to pass the main window as context when subscribing to the notifications. Qt automatically unsubscribes to notifications if the sender OR context is destroyed. Github-Pull: bitcoin-core/gui#680 Rebased-From: 8a5014c
1 parent 3e0cf5e commit e54a4de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/qt/bitcoingui.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ void BitcoinGUI::createMenuBar()
476476
connect(minimize_action, &QAction::triggered, [] {
477477
QApplication::activeWindow()->showMinimized();
478478
});
479-
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
479+
connect(qApp, &QApplication::focusWindowChanged, this, [minimize_action] (QWindow* window) {
480480
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
481481
});
482482

@@ -491,7 +491,7 @@ void BitcoinGUI::createMenuBar()
491491
}
492492
});
493493

494-
connect(qApp, &QApplication::focusWindowChanged, [zoom_action] (QWindow* window) {
494+
connect(qApp, &QApplication::focusWindowChanged, this, [zoom_action] (QWindow* window) {
495495
zoom_action->setEnabled(window != nullptr);
496496
});
497497
#endif

0 commit comments

Comments
 (0)