Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
4.8.0
-
None
-
Linux 64bit(amd64), gcc 4.4.5
Description
I encountered an error message, when I wrote the custom gui application class.
The application class has a QSystemTrayIcon object as child object on the heap.
The error was happen when I quited the application.
The message was as follows.
"The program has unexpectedly finished."
The following code causes the same error on my environment.
#include <QMainWindow> #include <QSystemTrayIcon> #include <QIcon> #include <QPixmap> #include <QObject> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow w; w.show(); // icon QPixmap pixmap(22, 22); pixmap.fill(Qt::green); QIcon icon(pixmap); // Case 1 : OK // QSystemTrayIcon trayIcon; // trayIcon.setIcon(icon); // trayIcon.show(); // Case 2 : Error. QSystemTrayIcon* trayIcon = new QSystemTrayIcon(&a); trayIcon->setIcon(icon); trayIcon->show(); // Case 3 : OK // QObject* object = new QObject(&a); return a.exec(); }