Skip to content

Commit 8a5014c

Browse files
committed
Fixes bitcoin#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.
1 parent 48174c0 commit 8a5014c

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
@@ -512,7 +512,7 @@ void BitcoinGUI::createMenuBar()
512512
connect(minimize_action, &QAction::triggered, [] {
513513
QApplication::activeWindow()->showMinimized();
514514
});
515-
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
515+
connect(qApp, &QApplication::focusWindowChanged, this, [minimize_action] (QWindow* window) {
516516
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
517517
});
518518

@@ -527,7 +527,7 @@ void BitcoinGUI::createMenuBar()
527527
}
528528
});
529529

530-
connect(qApp, &QApplication::focusWindowChanged, [zoom_action] (QWindow* window) {
530+
connect(qApp, &QApplication::focusWindowChanged, this, [zoom_action] (QWindow* window) {
531531
zoom_action->setEnabled(window != nullptr);
532532
});
533533
#endif

0 commit comments

Comments
 (0)