Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.5.0
-
None
-
Qt 5.5.0 gcc 64 from installer, KDE 4.13.3-0ubuntu0.2
Description
When the DBus / StatusNotifier based system tray icon is used with Qt 5.5.0, rebuilding the tray menu leads to a bad state. In this state, the old menu continues to be shown, but clicking on actions either has no effect or causes a crash.
Test code:
#include <QApplication> #include <QSystemTrayIcon> #include <QMenu> #include <QDebug> #include <QTimer> class Handler : public QObject { Q_OBJECT public slots: void trigger() { qDebug() << "Triggered"; } void setupMenu() { menu.clear(); QAction *action1 = menu.addAction("Debug output: Triggered"); connect(action1, SIGNAL(triggered()), SLOT(trigger())); QAction *action2 = menu.addAction("Re-setup menu"); connect(action2, SIGNAL(triggered()), SLOT(setupMenu())); menu.addAction(QString::number(rand())); } public: QMenu menu; }; int main(int argc, char *argv[]) { QApplication a(argc, argv); QSystemTrayIcon tray; Handler h; tray.setContextMenu(&h.menu); tray.show(); h.setupMenu(); return a.exec(); } #include "main.moc"
After clicking Re-setup menu the old menu continues to be shown and actions no longer work.
ogoffart suggested this may be related to menuItemsById not being cleaned up in http://code.woboq.org/qt5/qtbase/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp.html#menuItemsByID
See also https://github.com/owncloud/client/issues/3656 and possibly QTBUG-46293.
Attachments
Issue Links
- relates to
-
QTBUG-46293 REG: QMenu and QSystemTrayIcon/DBusTray: Context menu doesn't refresh submenus correctly, possible crash is some cases
- Closed
-
QTBUG-48647 [REG 4->5] Systray QMenu disappears after hide/show actions
- Closed
For Gerrit Dashboard: QTBUG-47863 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
124942,2 | QDBusPlatformMenu: Update on menu change | 5.5 | qt/qtbase | Status: ABANDONED | -1 | 0 |