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

QAbstractScrollArea::setViewport() causes crash when used from within event handler method

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.7.4
    • 4.7.0
    • Core: Event loop
    • None

    Description

      we need to free the opengl context of
      applications in the background as we otherwise run into various memory
      problems
      We tried the following approach: When the QGraphicsView receives a
      QEvent::WindowStateChange event which is representing a minimize event we call
      setViewport(new QWidget). If we are getting maximized we call setViewport(new
      QLWidget). Now the following happens: When tapping the home button to minimize
      the app touch events are generated and sent to the QGLWidget. The view is then
      minimized and the QGLWidget is destroyed by the setViewport(new QWidget) call.
      Now the events sent to the destroyed QGLWidget are actually processed and the
      app crashes.

      (gdb) bt
      #0 0x00fe1da3 in QCoreApplication::notifyInternal (this=0xbfffed38, receiver=0x81aa918, event=0xbfffddc8) at /home/shad/dev/qt-4.7/src/corelib/kernel/qcoreapplication.cpp:720
      #1 0x08060799 in QCoreApplication::sendEvent (receiver=0x81aa918, event=0xbfffddc8) at ../../../include/QtCore/../../../../dev/qt-4.7/src/corelib/kernel/qcoreapplication.h:215
      #2 0x00382ac8 in QGestureManager::deliverEvents (this=0x8196ed8, gestures=..., undeliveredGestures=0xbfffdfc0) at /home/shad/dev/qt-4.7/src/gui/kernel/qgesturemanager.cpp:666
      #3 0x00380a6b in QGestureManager::filterEventThroughContexts (this=0x8196ed8, contexts=..., event=0xbfffe274) at /home/shad/dev/qt-4.7/src/gui/kernel/qgesturemanager.cpp:351
      #4 0x00381b6b in QGestureManager::filterEvent (this=0x8196ed8, receiver=0x81aac28, event=0xbfffe274) at /home/shad/dev/qt-4.7/src/gui/kernel/qgesturemanager.cpp:508
      #5 0x00a83c61 in QGraphicsScenePrivate::sendEvent (this=0x8198988, item=0x81aac30, event=0xbfffe274) at /home/shad/dev/qt-4.7/src/gui/graphicsview/qgraphicsscene.cpp:1185
      #6 0x00a92de3 in QGraphicsScene::sendEvent (this=0xbfffe324, item=0x81aac30, event=0xbfffe274) at /home/shad/dev/qt-4.7/src/gui/graphicsview/qgraphicsscene.cpp:5634
      #7 0x08050e4e in sendCustomGesture (event=0xbfffe274, object=0x81aac28, scene=0xbfffe324) at /home/shad/dev/qt-4.7/tests/auto/gestures/tst_gestures.cpp:310
      #8 0x0805f394 in tst_Gestures::changeViewport (this=0xbfffed30) at /home/shad/dev/qt-4.7/tests/auto/gestures/tst_gestures.cpp:2116
      #9 0x0805fb11 in tst_Gestures::qt_metacall (this=0xbfffed30, _c=QMetaObject::InvokeMetaMethod, _id=34, _a=0xbfffe3f8) at .moc/debug-shared/tst_gestures.moc:312
      #10 0x00fe9ca6 in QMetaObject::metacall (object=0xbfffed30, cl=QMetaObject::InvokeMetaMethod, idx=38, argv=0xbfffe3f8) at /home/shad/dev/qt-4.7/src/corelib/kernel/qmetaobject.cpp:237
      #11 0x00fec4c3 in QMetaMethod::invoke (this=0xbfffe55c, object=0xbfffed30, connectionType=Qt::DirectConnection, returnValue=..., val0=..., val1=..., val2=..., val3=..., val4=...,
      val5=..., val6=..., val7=..., val8=..., val9=...) at /home/shad/dev/qt-4.7/src/corelib/kernel/qmetaobject.cpp:1575
      #12 0x00feb9ea in QMetaObject::invokeMethod (obj=0xbfffed30, member=0x8195368 "changeViewport", type=Qt::DirectConnection, ret=..., val0=..., val1=..., val2=..., val3=..., val4=...,
      val5=..., val6=..., val7=..., val8=..., val9=...) at /home/shad/dev/qt-4.7/src/corelib/kernel/qmetaobject.cpp:1148
      #13 0x00137f5a in QMetaObject::invokeMethod (obj=0xbfffed30, member=0x8195368 "changeViewport", type=Qt::DirectConnection, val0=..., val1=..., val2=..., val3=..., val4=..., val5=...,
      val6=..., val7=..., val8=..., val9=...) at ../../include/QtCore/../../../../dev/qt-4.7/src/corelib/kernel/qobjectdefs.h:408
      #14 0x001356b1 in qInvokeTestMethodDataEntry (slot=0x8195368 "changeViewport") at /home/shad/dev/qt-4.7/src/testlib/qtestcase.cpp:1244
      #15 0x00135ca7 in qInvokeTestMethod (slotName=0x806899b "changeViewport()", data=0x0) at /home/shad/dev/qt-4.7/src/testlib/qtestcase.cpp:1352
      #16 0x0013630c in qInvokeTestMethods (testObject=0xbfffed30) at /home/shad/dev/qt-4.7/src/testlib/qtestcase.cpp:1497
      #17 0x00136a84 in QTest::qExec (testObject=0xbfffed30, argc=2, argv=0xbfffee04) at /home/shad/dev/qt-4.7/src/testlib/qtestcase.cpp:1716
      #18 0x0805f462 in main (argc=2, argv=0xbfffee04) at /home/shad/dev/qt-4.7/tests/auto/gestures/tst_gestures.cpp:2119

      I've attached a patch for the autotest to reproduce the issue.

      Attachments

        Issue Links

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

          Activity

            People

              ekoppen Eckhart Köppen
              dzyubenk Denis Dzyubenko (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes