Skip to content

Commit 272fa25

Browse files
john-moffetthebasto
authored andcommitted
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. Github-Pull: bitcoin-core/gui#680 Rebased-From: 8a5014c
1 parent 7b7bbc1 commit 272fa25

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
@@ -488,7 +488,7 @@ void BitcoinGUI::createMenuBar()
488488
connect(minimize_action, &QAction::triggered, [] {
489489
QApplication::activeWindow()->showMinimized();
490490
});
491-
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
491+
connect(qApp, &QApplication::focusWindowChanged, this, [minimize_action] (QWindow* window) {
492492
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
493493
});
494494

@@ -503,7 +503,7 @@ void BitcoinGUI::createMenuBar()
503503
}
504504
});
505505

506-
connect(qApp, &QApplication::focusWindowChanged, [zoom_action] (QWindow* window) {
506+
connect(qApp, &QApplication::focusWindowChanged, this, [zoom_action] (QWindow* window) {
507507
zoom_action->setEnabled(window != nullptr);
508508
});
509509
#endif

0 commit comments

Comments
 (0)