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

Intermittent segmentation faults if you create QApplication from heap

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes