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

Reproducible crash from wheelEvent in QGraphicsScene containing a QWidget with a Q*BoxLayout

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.2.0 Beta3, 6.3.0 Alpha
    • 6.1.2, 6.2.0 Beta1, 6.2.0 Beta2
    • Widgets: GraphicsView
    • None
    • macOS 11.5, MacBook Air 2020 (intel), Qt6 6.1.2/6.2b1/6.2b2
    • macOS
    • 06235d36ae9d00366215e748d80ff0faed3c2124 (qt/qtbase/dev) 2366be3c2c1e0277f5dba178729fa38a2d1d8dbe (qt/qtbase/6.2)

    Description

      If a QWidget containing a QVBox- or QHBoxLayout is added to a QGraphicsScene  that is large enough to cause the parent QGraphicsView to allow for scrolling any such scroll motion will cause a crash in what looks like a recursive wheelEvent handler.

      This crash is currently 100% reproducible on macOS 11.x in all available Qt6 versions.
      The problem does however not occur on Windows 10 nor on any platform with Qt5.

      I attached a simple code example that reproduces the issue reliably.

      Steps to reproduce:

      • extract the sample project attached to this bug
      • run qmake6 to create a Makefile
      • run make to build the project
      • run 'open wheelCrash.app' to open the generated app
      • attempt to scroll the view

      Expected behaviour:

      • the view should scroll without issue, revealing it's hidden items

      Observed behaviour:

      • the application crashes 100% of the time

       
      Here is the gist of the backtrace, which is always identical.
      I will attache the full trace to the issue:

      0   tiny_malloc_should_clear + 228
      1   szone_malloc_should_clear + 66
      2   _malloc_zone_malloc + 118
      3   QArrayData::allocate(QArrayData**, long long, long long, long long, QArrayData::AllocationOption) + 222
      4   QList<QPainterPath::Element>::reserve(long long) + 129
      5   QPainterPath::addRect(QRectF const&) + 444
      6   non-virtual thunk to QGraphicsWidget::shape() const + 65
      7   QGraphicsItem::collidesWithPath(QPainterPath const&, Qt::ItemSelectionMode) const + 436
      8   QGraphicsSceneIndexPrivate::itemCollidesWithPath(QGraphicsItem const*, QPainterPath const&, Qt::ItemSelectionMode) + 30
      9   QtPrivate::intersect_rect(QGraphicsItem const*, QRectF const&, Qt::ItemSelectionMode, QTransform const&, void const*) + 764
      10  QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem*, QRectF, bool (*)(QGraphicsItem const*, QRectF const&, Qt::ItemSelectionMode, QTransform const&, void const*), QList<QGraphicsItem*>*, QTransform const&, Qt::ItemSelectionMode, double, void const*) const + 497
      11  QGraphicsSceneIndexPrivate::items_helper(QRectF const&, bool (*)(QGraphicsItem const*, QRectF const&, Qt::ItemSelectionMode, QTransform const&, void const*), QList<QGraphicsItem*>*, QTransform const&, Qt::ItemSelectionMode, Qt::SortOrder, void const*) const + 151
      12  QGraphicsSceneIndex::items(QRectF const&, Qt::ItemSelectionMode, Qt::SortOrder, QTransform const&) const + 234
      13  QGraphicsScenePrivate::itemsAtPosition(QPoint const&, QPointF const&, QWidget*) const + 412
      
      [... this part of the trace repeats a few hundret times start ...]
      
      14  QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent*) + 89
      15  QGraphicsScene::event(QEvent*) + 1100
      16  QApplicationPrivate::notify_helper(QObject*, QEvent*) + 247
      17  QApplication::notify(QObject*, QEvent*) + 501
      18  QCoreApplication::notifyInternal2(QObject*, QEvent*) + 169
      19  QGraphicsView::wheelEvent(QWheelEvent*) + 460
      20  QWidget::event(QEvent*) + 1226
      21  QFrame::event(QEvent*) + 43
      22  QGraphicsView::viewportEvent(QEvent*) + 1223
      23  QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 232
      24  QApplicationPrivate::notify_helper(QObject*, QEvent*) + 227
      25  QApplication::notify(QObject*, QEvent*) + 7477
      26  QCoreApplication::notifyInternal2(QObject*, QEvent*) + 169
      
      [... this part of the trace repeats a few hundret times end ...]
      
      499 QGraphicsView::wheelEvent(QWheelEvent*) + 460
      500 QWidget::event(QEvent*) + 1226
      501 QFrame::event(QEvent*) + 43
      502 QGraphicsView::viewportEvent(QEvent*) + 1223
      503 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 232
      504 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 227
      505 QApplication::notify(QObject*, QEvent*) + 7477
      506 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 169
      507 QGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent*) + 805
      508 QGraphicsItem::sceneEvent(QEvent*) + 660
      509 QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent*) + 514
      510 QGraphicsScene::event(QEvent*) + 1100
      511 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 247
      

      Attachments

        1. qt6_wheelCrash.zip
          2 kB
          Rene Koecher
        2. wheelCrash_crashReport.txt
          117 kB
          Rene Koecher
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vhilshei Volker Hilsheimer
            rkoecher Rene Koecher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: