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

Crash when call huge amount of processEvents in resizeEvent

    XMLWordPrintable

Details

    Description

      Call huge amount of processEvents in mainwindow centralwidget resizeEvent. To reproduce separated centralwidget is is needed where processEvents are called in loop (tested 5000/10000 times).
      Code to reproduce:

      main.cpp
      #include <QApplication>
      #include <QMainWindow>
      #include <QResizeEvent>
      #include <QWidget>
      
      class View: public QWidget
      {
      public:
          View(QWidget *parent = 0): QWidget(parent) {}
      
          void resizeEvent(QResizeEvent*) {
              for (unsigned i = 0; i < 10000; ++i) {
                  qApp->processEvents();
              }
          }
      };
      
      int main(int argc, char** argv)
      {
          QApplication app(argc,argv);
          QMainWindow mainWindow;
          View view(&mainWindow);
          mainWindow.setCentralWidget(&view);
          mainWindow.show();
          return app.exec();
      }
      

      Callstack shows that some animation cause Segmentation fault.

      QVariantAnimation::keyValueAt(double) const	/usr/local/Trolltech/Qt-4.8.5/lib/libQtCore.so.4		0xb7252863	
      QVariantAnimation::startValue() const	/usr/local/Trolltech/Qt-4.8.5/lib/libQtCore.so.4		0xb72528f0	
      QPropertyAnimation::updateState(QAbstractAnimation::State, QAbstractAnimation::State)	/usr/local/Trolltech/Qt-4.8.5/lib/libQtCore.so.4		0xb725606e	
      QLayoutPrivate::doResize(QSize const&)	/usr/local/Trolltech/Qt-4.8.5/lib/libQtGui.so.4		0xb767caa2	
      QLayout::widgetEvent(QEvent*)	/usr/local/Trolltech/Qt-4.8.5/lib/libQtGui.so.4		0xb767e40b	
      QApplicationPrivate::notify_helper(QObject*, QEvent*)	/usr/local/Trolltech/Qt-4.8.5/lib/libQtGui.so.4		0xb764dec2	
      QApplication::notify(QObject*, QEvent*)	/usr/local/Trolltech/Qt-4.8.5/lib/libQtGui.so.4		0xb7653302	
      QCoreApplication::notifyInternal(QObject*, QEvent*)	/usr/local/Trolltech/Qt-4.8.5/lib/libQtCore.so.4		0xb73862ee	
      QApplication::x11ProcessEvent(_XEvent*)	/usr/local/Trolltech/Qt-4.8.5/lib/libQtGui.so.4		0xb76d767e	
      

      Crash is can be avoided when animation delete is removed from qabstractanimation.cpp, which of course is not solution:

      ...
          case QAbstractAnimation::Stopped:
              // Leave running state.
              int dura = q->duration();
      
      //        if (deleteWhenStopped)
      //            q->deleteLater();
      
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes