Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-22632

child QSystemTrayIcon of QApplication causes an error, when the application finished.

    XMLWordPrintable

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();
      }
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            kichi Yoshizo Kawasaki
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes