All QSystemTrayIcon have the same icon, and QSystemTrayIcon::isSystemTrayAvailable remove all QSystemTrayIcon

Bug #1574699 reported by ogoffart
102
This bug affects 20 people
Affects Status Importance Assigned to Milestone
appmenu-qt5
New
Undecided
Unassigned
appmenu-qt5 (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Fix Released
Undecided
Dmitry Shachnev

Bug Description

# Impact
This affects all Qt applications that use QSystemTrayIcon::​isSystemTrayAvailable, in Unity environment. Confirmed examples are owncloud-client and keepassxc, but there may be more applications.

# Test Case
See the original description below for the test case in C++.

# Proposed Fix
The proposed fix is identical to what was uploaded to Yakkety as version 0.3.0+16.10.20160628.1-0ubuntu1. The fix is using unique connections for all AppMenuPlatformSystemTrayIcon instances.

# Regression Potential
The fix is in Yakkety since June and in Zesty, and nobody complained so far. So it should not cause any regressions.

-----------------------------------------------------------------------------
in appmenu-qt5 in ubuntu 16.04, the AppMenuPlatformSystemTrayIcon assumes there is only one instance of a QPlatformSystemTrayIcon: it register the same dbus name for all the instances. In fact, there is one instance of QPlatformSystemTrayIcon per instance of QSystemTrayIcon, and one temporary is created for QSystemTrayIcon::isSystemTrayAvailable.

This breaks the owncloud client [issue https://github.com/owncloud/client/issues/4693 ]

This example reproduces the problem:

```
#include <QtWidgets>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QImage img(64,64, QImage::Format_ARGB32);
    img.fill(Qt::red);
    QSystemTrayIcon sti(QIcon(QPixmap::fromImage(img)));
    sti.show();

     QSystemTrayIcon::isSystemTrayAvailable(); // with this line, the QSystemTrayIcon does not appear
     // comment the previous line to see that the QSystemTrayIcon works and that there is a bug in that line

    return a.exec();
}
```

This testcase shows that the AppMenuPlatformSystemTrayIcon::~AppMenuPlatformSystemTrayIcon called by the temporary object created inside QSystemTrayIcon::isSystemTrayAvailable unregisters the icon.

Related branches

Revision history for this message
Anatoli (anatoli) wrote :
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Anatoli: if the fix in the linked branch (also present in Ubuntu 16.10) works for you, I can backport it to Ubuntu 16.04 too.

Revision history for this message
Anatoli (anatoli) wrote :

Dmitry, just seen your answer. Is there any way to install the version with the fix without updating the entire QT5 stack (the version from 16.10 depends on a number of QT5 libs v5.6.1, but 16.04 ships v5.5.1)?

I could install it from your PPA if you add the fixed version there, without the higher version dependency for other libs.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :
Revision history for this message
Anatoli (anatoli) wrote :

Dmitry, just tried it and it works perfectly!

Could you please also check the bugs #1313248 and #1380702 as they seem related?

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

> Dmitry, just tried it and it works perfectly!

OK, starting the stable release upload procedure then.

> Could you please also check the bugs #1313248 and #1380702 as they seem related?

They are not related, but a fix will be available in the next upload (first in 17.04, then can be backported to 16.04 if it works).

Changed in appmenu-qt5 (Ubuntu):
status: New → Fix Released
Changed in appmenu-qt5 (Ubuntu Xenial):
assignee: nobody → Dmitry Shachnev (mitya57)
status: New → In Progress
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello ogoffart, or anyone else affected,

Accepted appmenu-qt5 into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/appmenu-qt5/0.3.0+16.04.20151130-0ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in appmenu-qt5 (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Anatoli (anatoli) wrote :

Brian, I just updated the package from xenial-proposed (appmenu-qt5/xenial-proposed,now 0.3.0+16.04.20151130-0ubuntu2 amd64). This bug is fixed. No other issues detected.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Marking verification-done based on comment #8 and my own testing in https://code.launchpad.net/~mitya57/appmenu-qt5/lp1574699/+merge/294381/comments/768173.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package appmenu-qt5 - 0.3.0+16.04.20151130-0ubuntu2

---------------
appmenu-qt5 (0.3.0+16.04.20151130-0ubuntu2) xenial; urgency=medium

  * Fix for creating two or more system tray icons (LP: #1574699).

 -- Dmitry Shachnev <email address hidden> Wed, 25 Jan 2017 22:52:49 +0300

Changed in appmenu-qt5 (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for appmenu-qt5 has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.