mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
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.
This commit is contained in:
parent
48174c0f28
commit
8a5014cd8a
@ -512,7 +512,7 @@ void BitcoinGUI::createMenuBar()
|
|||||||
connect(minimize_action, &QAction::triggered, [] {
|
connect(minimize_action, &QAction::triggered, [] {
|
||||||
QApplication::activeWindow()->showMinimized();
|
QApplication::activeWindow()->showMinimized();
|
||||||
});
|
});
|
||||||
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
|
connect(qApp, &QApplication::focusWindowChanged, this, [minimize_action] (QWindow* window) {
|
||||||
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
|
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ void BitcoinGUI::createMenuBar()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(qApp, &QApplication::focusWindowChanged, [zoom_action] (QWindow* window) {
|
connect(qApp, &QApplication::focusWindowChanged, this, [zoom_action] (QWindow* window) {
|
||||||
zoom_action->setEnabled(window != nullptr);
|
zoom_action->setEnabled(window != nullptr);
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user