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

SEGFAULT while resizing the desktop

    XMLWordPrintable

Details

    Description

      Consider the following example:

      #include <QtCore>
      #include <QtGui>
      #include <QtWidgets>
      
      class Widget : public QWidget
      {
          Q_OBJECT
      
      private slots:
          void updateGeometry()
          {
              QRect rc = QApplication::desktop()->availableGeometry();
      
              move(rc.topLeft());
              resize(rc.size());
          }
      
      public:
          Widget() : QWidget()
          {
              updateGeometry();
      
              connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(updateGeometry()));
      
              show();
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          new Widget;
      
          return app.exec();
      }
      
      #include "main.moc"

      Compile and run. Open the System Settings, Display settings. Resize the desktop to be larger (for example 1360x768 -> 1600x900). The widget is resized correctly. Resize the desktop back to 1360x768. The application crashes. In console I see

      QBackingStore::flush() called for  QWidgetWindow(0x923a358, name = "WidgetClassWindow")  which does not have a handle.
      Segmentation fault (core dumped)

      GDB backtrace:

      BackingStore::flush() called for  QWidgetWindow(0x8080820, name = "WidgetClassWindow")  which does not have a handle.
                                                                                                                           Program received signal SIGSEGV, Segmentation fault.
      0xb6c97b14 in QScreen::handle() const () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Gui.so.5
      (gdb) bt
      #0  0xb6c97b14 in QScreen::handle() const () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Gui.so.5
      #1  0xb4c0cbee in ?? () from /opt/Qt-5.4.0/5.4/gcc/plugins/platforms/libqxcb.so
      #2  0xb6e40c56 in QBackingStore::resize(QSize const&) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Gui.so.5
      #3  0xb7a5b1e5 in ?? () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Widgets.so.5
      #4  0xb7a5c79c in ?? () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Widgets.so.5
      #5  0xb7a82015 in QWidgetPrivate::syncBackingStore() () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Widgets.so.5
      #6  0xb7a913ad in QWidget::event(QEvent*) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Widgets.so.5
      #7  0xb7a4e054 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Widgets.so.5
      #8  0xb7a51a6b in QApplication::notify(QObject*, QEvent*) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Widgets.so.5
      #9  0xb76f6a7e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Core.so.5
      #10 0xb76f9ae0 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Core.so.5
      #11 0xb76fa043 in QCoreApplication::sendPostedEvents(QObject*, int) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Core.so.5
      #12 0xb7758104 in ?? () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Core.so.5
      #13 0xb6a781e3 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
      #14 0xb6a78468 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
      #15 0xb6a78528 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
      #16 0xb7758538 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Core.so.5
      #17 0xb4c625c6 in ?? () from /opt/Qt-5.4.0/5.4/gcc/plugins/platforms/libqxcb.so
      #18 0xb76f44b6 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Core.so.5
      #19 0xb76f492c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Core.so.5
      #20 0xb76fa0e9 in QCoreApplication::exec() () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Core.so.5
      #21 0xb6c634f4 in QGuiApplication::exec() () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Gui.so.5
      #22 0xb7a47464 in QApplication::exec() () from /opt/Qt-5.4.0/5.4/gcc/lib/libQt5Widgets.so.5
      #23 0x08049f22 in main (argc=1, argv=0xbffff004) at main.cpp:36

      Attachments

        Issue Links

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

          Activity

            People

              paeglis Gatis Paeglis
              dmitry64 Dmitry
              Votes:
              4 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes