in qppmenu-qt5 in ubuntu 16.4, the AppMenuPlatformSystemTrayIcon assumes there is only one instance of a QPlatformSystemTrayIcon: it register the same sbus 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.
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.
in qppmenu-qt5 in ubuntu 16.4, the AppMenuPlatform SystemTrayIcon assumes there is only one instance of a QPlatformSystem TrayIcon: it register the same sbus name for all the instances. In fact, there is one instance of QPlatformSystem TrayIcon per instance of QSystemTrayIcon, and one temporary is created for QSystemTrayIcon ::isSystemTrayA vailable.
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[]) :Format_ ARGB32) ; fill(Qt: :red); QPixmap: :fromImage( img)));
{
QApplication a(argc, argv);
QImage img(64,64, QImage:
img.
QSystemTrayIcon sti(QIcon(
sti.show();
QSystemTra yIcon:: isSystemTrayAva ilable( ); // 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 AppMenuPlatform SystemTrayIcon: :~AppMenuPlatfo rmSystemTrayIco n called by the temporary object created inside QSystemTrayIcon ::isSystemTrayA vailable unregisters the icon.