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

Segmentation fault after creating & destroying QApplication

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.8.4
    • None
    • Ubuntu 13.10, libqt4* packages version 4.8.4+dfsg-0ubuntu18

      Consider following example:

      #include <QtGui/QApplication>
      
      int main(int argc, char *argv[])
      {
         QApplication * app;
         
         app = new QApplication(argc, argv);
         delete app;
      
         app = new QApplication(argc, argv);
         delete app;
      }
      

      In this example second creation of QApplication fails with segmentation fault in src/gui/styles/qgtkstyle_p.cpp:

      void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget)
      {
          if (Q_GTK_IS_WIDGET(widget)) {
              static GtkWidget* protoLayout = 0;
              if (!protoLayout) {
                  protoLayout = QGtkStylePrivate::gtk_fixed_new();
                  QGtkStylePrivate::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value("GtkWindow")), protoLayout);
              }
              Q_ASSERT(protoLayout);
      
              if (!widget->parent && !GTK_WIDGET_TOPLEVEL(widget))
                  QGtkStylePrivate::gtk_container_add((GtkContainer*)(protoLayout), widget); // SEGFAULT HERE
              QGtkStylePrivate::gtk_widget_realize(widget);
          }
      }
      

      Probably, due to rotten static variable resources.

      I didn't found that it is forbidden to recreate QApplication and at least this issue was fixed: QTBUG-7029.

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

            peppe Giuseppe D'Angelo
            vrutsky Vladimir Rutsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes