diff options
author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2023-11-12 12:04:12 +0300 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-11-13 15:35:54 +0000 |
commit | b71aa3c661797a916effd29171665ea838816595 (patch) | |
tree | 56d7a020a9f8223d3b1b18702530f0a77dc8bc3f | |
parent | 9bccfb56c272b50b4c3a7a8ec682220ab9b1a699 (diff) |
QSystemTrayIcon: properly disconnect old menu in setContextMenu()
Amends 121a30ccef3b6306c1da4f415fe1305dbf2dd901
Fix the unfortunate mistake where oldMenu was not properly disconnected
from the contextMenuRequested() signal. This could lead to a situation
when several menus are displayed at the same time.
Fixes: QTBUG-78737
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ice59841724207192eacd5a52b644f83159e09913
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r-- | src/widgets/util/qsystemtrayicon.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 4794cde6ad..55a243c834 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -171,7 +171,7 @@ void QSystemTrayIcon::setContextMenu(QMenu *menu) if (d->qpa_sys) { // Show the QMenu-based menu for QPA plugins that do not provide native menus if (oldMenu && !oldMenu->platformMenu()) - QObject::disconnect(d->qpa_sys, &QPlatformSystemTrayIcon::contextMenuRequested, menu, nullptr); + QObject::disconnect(d->qpa_sys, &QPlatformSystemTrayIcon::contextMenuRequested, oldMenu, nullptr); if (menu && !menu->platformMenu()) { QObject::connect(d->qpa_sys, &QPlatformSystemTrayIcon::contextMenuRequested, menu, |