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

Intermittent segmentation faults if you create QApplication from heap

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.5.0
    • QPA: X11/XCB
    • Ubuntu 14.04 64-bit (gcc 4.8.4)

    Description

      The attached example can be used to reproduce the crash:

      #include <QApplication>
      #include <QWidget>
      #include <QScopedPointer>
      
      int main(int argc, char **argv)
      {
          QApplication *app = new QApplication(argc, argv);
          //QScopedPointer<QApplication> app(new QApplication(argc, argv));
      
          QWidget widget;
          widget.show();
          return app->exec();
      }
      

      Steps to reproduce:
      1. Run the attached example application
      2. close the window
      3. repeat if you don't see a seg fault

      Expected result:
      No segmentation fault should happen

      Actual result:
      There comes a segmentation fault around every 7th time.

      As a workaround one can use QScopedPointer instead of QApplication to prevent it from crashing if the QApplication is created from heap.

      Attachments

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

        Activity

          People

            paeglis Gatis Paeglis
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes