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

[QCocoaView scrollWheel:] can end up recursing infinitely when a scrollWheel event is sent to two stacked MDI windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 4.7.2
    • 4.6.2
    • Core: Event loop
    • None
    • Mac OS X - 10.6.4
    • 22fd9b9780389f51ab3dd1865d2b5686fa34e6ff

      Steps to recreate:

      1) 64-bit Mac application (Cocoa) using a QMdiArea and QMdiSubWindow with scrolling views
      2) open two MDI windows and place one over the other
      3) generate a mouse scroll wheel event over the section of the front most MDI window that overlaps the other MDI window
      4) when it doesn't crash, the two MDI windows will exchange z position and focus rapidly
      5) when it does crash, [QCocoaView scrollWheel:] starts recursing until the app runs out of stack - partial stack trace when it finally crashes

      #0 0x0000000101c0bd44 in QTextEngine::itemize (this=Cannot access memory at address 0x7fff5f3ff7b8
      ) at text/qtextengine.cpp:1393
      #1 0x0000000101c0c82d in QTextEngine::attributes (this=0x7fff5f405770) at text/qtextengine.cpp:1320
      #2 0x0000000101c0cbbb in QTextEngine::shapeTextMac (this=0x7fff5f405770, item=0) at qtextengine_mac.cpp:577
      #3 0x0000000101c0d257 in QTextEngine::shapeText (this=0x7fff5f405770, item=0) at text/qtextengine.cpp:870
      #4 0x0000000101c0d85e in QTextEngine::shape (this=0x7fff5f405770, item=0) at text/qtextengine.cpp:1359
      #5 0x0000000101c0f7b3 in QTextEngine::width (this=0x7fff5f405770, from=0, len=9) at text/qtextengine.cpp:1550
      #6 0x0000000101c0fcba in QTextEngine::elidedText (this=0x7fff5f405770, mode=Qt::ElideRight, width=@0x7fff5f4080b0, flags=0) at text/qtextengine.cpp:2320
      #7 0x0000000101be7119 in QFontMetrics::elidedText (this=0x7fff5f4082c0, text=@0x11e5d3eb0, mode=Qt::ElideRight, width=160, flags=0) at text/qfontmetrics.cpp:877
      #8 0x0000000101e3f1f2 in QMdiSubWindowPrivate::titleBarOptions (this=0x11e5d3bc0) at widgets/qmdisubwindow.cpp:1671
      #9 0x0000000101e4e1db in QMdiSubWindowPrivate::titleBarHeight (this=0x11e5d3bc0) at qmdisubwindow_p.h:294
      #10 0x0000000101e499fd in QMdiSubWindowPrivate::setActive (this=0x11e5d3bc0, activate=false, changeFocus=true) at widgets/qmdisubwindow.cpp:1464
      #11 0x0000000101e37158 in QMdiAreaPrivate::_q_deactivateAllWindows (this=0x115a9c850, aboutToActivate=0x0) at widgets/qmdiarea.cpp:731
      #12 0x0000000101e379ae in QMdiArea::qt_metacall (this=0x115a50b00, _c=QMetaObject::InvokeMetaMethod, _id=9, _a=0x7fff5f4086e0) at moc_qmdiarea.cpp:143
      #13 0x00000001011a7032 in sipQMdiArea::qt_metacall ()
      #14 0x0000000102d4f806 in QMetaObject::metacall (object=0x115a50b00, cl=QMetaObject::InvokeMetaMethod, idx=40, argv=0x7fff5f4086e0) at kernel/qmetaobject.cpp:237
      #15 0x0000000102d54944 in QMetaObject::activate (sender=0x11e57f590, m=0x10250c8c0, local_signal_index=1, argv=0x0) at kernel/qobject.cpp:3285
      #16 0x0000000101e3d282 in QMdiSubWindow::aboutToActivate (this=0x11e57f590) at moc_qmdisubwindow.cpp:143
      #17 0x0000000101e496b8 in QMdiSubWindowPrivate::setActive (this=0x11e55e760, activate=true, changeFocus=true) at widgets/qmdisubwindow.cpp:1434
      #18 0x0000000101e4bd8f in QMdiSubWindowPrivate::_q_processFocusChanged (this=0x11e55e760, old=0x11e5f7c70, now=0x11e33cd90) at widgets/qmdisubwindow.cpp:975
      #19 0x0000000101e4bee7 in QMdiSubWindow::qt_metacall (this=0x11e57f590, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0x7fff5f408ad0) at moc_qmdisubwindow.cpp:96
      #20 0x00000001011a1f92 in sipQMdiSubWindow::qt_metacall ()
      #21 0x0000000102d4f806 in QMetaObject::metacall (object=0x11e57f590, cl=QMetaObject::InvokeMetaMethod, idx=33, argv=0x7fff5f408ad0) at kernel/qmetaobject.cpp:237
      #22 0x0000000102d54944 in QMetaObject::activate (sender=0x100670970, m=0x1024f65c0, local_signal_index=1, argv=0x7fff5f408ad0) at kernel/qobject.cpp:3285
      #23 0x00000001019614d7 in QApplication::focusChanged (this=0x100670970, _t1=0x11e5f7c70, _t2=0x11e33cd90) at moc_qapplication.cpp:191
      #24 0x00000001019690a9 in QApplicationPrivate::setFocusWidget (focus=0x11e33cd90, reason=Qt::MouseFocusReason) at kernel/qapplication.cpp:2141
      #25 0x00000001019c9a8f in QWidget::setFocus (this=0x11e33cd90, reason=Qt::MouseFocusReason) at kernel/qwidget.cpp:6135
      #26 0x0000000101961ed1 in QApplicationPrivate::giveFocusAccordingToFocusPolicy (widget=0x11e33cd90, focusPolicy=Qt::WheelFocus, focusReason=Qt::MouseFocusReason) at kernel/qapplication.cpp:5315
      #27 0x0000000101963fc3 in QApplication::notify (this=0x100670970, receiver=0x11e33cd90, e=0x7fff5f4094d0) at kernel/qapplication.cpp:3913
      #28 0x000000010131aa5e in sipQApplication::notify ()
      #29 0x0000000102d4d836 in QCoreApplication::notifyInternal (this=0x100670970, receiver=0x11e33cd90, event=0x7fff5f4094d0) at kernel/qcoreapplication.cpp:704
      #30 0x00000001018d8e99 in QCoreApplication::sendSpontaneousEvent (receiver=0x11e33cd90, event=0x7fff5f4094d0) at qcoreapplication.h:218
      #31 0x0000000101961b94 in qt_sendSpontaneousEvent (receiver=0x11e33cd90, event=0x7fff5f4094d0) at kernel/qapplication.cpp:5279
      #32 0x00000001018ec5f7 in -[QCocoaView scrollWheel:] (self=0x11e377db0, _cmd=0x7fff86db1818, theEvent=0x11e5be0e0) at kernel/qcocoaview_mac.mm:843
      #33 0x00007fff866de5ee in forwardMethod ()
      #34 0x00007fff8680618a in -[NSView scrollWheel:] ()
      #35 0x00000001018ec971 in -[QCocoaView scrollWheel:] (self=0x11e33ab40, _cmd=0x7fff86db1818, theEvent=0x11e5be0e0) at kernel/qcocoaview_mac.mm:869
      #36 0x00007fff866de5ee in forwardMethod ()
      #37 0x00007fff8680618a in -[NSView scrollWheel:] ()
      #38 0x00000001018ec971 in -[QCocoaView scrollWheel:] (self=0x11e340c10, _cmd=0x7fff86db1818, theEvent=0x11e5be0e0) at kernel/qcocoaview_mac.mm:869
      #39 0x00007fff866de5ee in forwardMethod ()
      #40 0x00007fff8680618a in -[NSView scrollWheel:] ()
      #41 0x00000001018ec971 in -[QCocoaView scrollWheel:] (self=0x11e37e1e0, _cmd=0x7fff86db1818, theEvent=0x11e5be0e0) at kernel/qcocoaview_mac.mm:869
      #42 0x00007fff866de5ee in forwardMethod ()
      #43 0x00007fff8680618a in -[NSView scrollWheel:] ()
      #44 0x00000001018ec971 in -[QCocoaView scrollWheel:] (self=0x11e3a6f40, _cmd=0x7fff86db1818, theEvent=0x11e5be0e0) at kernel/qcocoaview_mac.mm:869
      #45 0x00007fff866de5ee in forwardMethod ()
      #46 0x00007fff8680618a in -[NSView scrollWheel:] ()
      #47 0x00000001018ec971 in -[QCocoaView scrollWheel:] (self=0x11e376140, _cmd=0x7fff86db1818, theEvent=0x11e5be0e0) at kernel/qcocoaview_mac.mm:869
      #48 0x00007fff866de5ee in forwardMethod ()
      #49 0x00007fff8680618a in -[NSView scrollWheel:] ()
      #50 0x00000001018ec971 in -[QCocoaView scrollWheel:] (self=0x11e376be0, _cmd=0x7fff86db1818, theEvent=0x11e5be0e0) at kernel/qcocoaview_mac.mm:869
      #51 0x00007fff866de5ee in forwardMethod ()
      #52 0x00007fff8680618a in -[NSView scrollWheel:] ()
      #53 0x00000001018ec971 in -[QCocoaView scrollWheel:] (self=0x11e377db0, _cmd=0x7fff86db1818, theEvent=0x11e5be0e0) at kernel/qcocoaview_mac.mm:869
      [... previous 3 frames repeat 1000s of times ...]

      It appears what is happening is that the upper window is not consuming the scroll wheel event and it is passing on to the lower MDI window. That causes the lower window to gain focus and come to front without consuming the event. Then the upper window uses the Cocoa responder chain to forward the event to the new lower window - which then activates, comes forward and tries to forward the event to the new lower window.

        1. qttest.cc
          1 kB
        2. qttest.h
          0.4 kB
        3. qttest.pro
          0.3 kB
        4. test.py
          0.7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            cduclos Carlos Duclos (Inactive)
            david_k_hess David Hess
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes