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

Qt crashes if the monitored object is deleted in eventFilter() during QEvent::Wheel event filtering

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.7.0
    • Core: Event loop
    • None
    • Mac OS X 10.6.4 Build 10F569
      Qt 4.7.0
    • macOS

    Description

      This issue appears on Qt (Carbon&Cocoa) for Mac OS X, when the widget being scrolled with Mac Multi-touch TrackPad is deleted in the installed eventFilter() method.

      Steps to reproduce:
      + Create a monitored QWidget.
      + Install an eventFilter() on this monitored widget.
      In the eventFilter(), delete the monitored widget, upon receiving QWheelEvent. (Return true, according to Qt event processing rules)
      + Scroll the monitored widget by using Mac Multi-touch TrackPad. (Scroll in both directions: vertical & horizontal)

      • Qt may crash upon delivery of QWheelEvent to a deleted object.

      Probable reason:
      Qt doesn't check if the target widget exists upon delivery of the second (Qt::Vertical) QWheelEvent.
      See: /src/gui/kernel/qapplication_mac.mm:2173 for Carbon implementation of QWheelEvent delivery.
      + The check for the existence of a target widget is performed at qapplication_mac.mm:2173 ------ if(widget) {
      + The delivery of the first (Qt::Horizontal) QWheelEvent is performed at qapplication_mac.mm:2187 ------ QApplication::sendSpontaneousEvent(widget, &qwe);

      • the widget can be deleted upon filtering the first (Qt::Horizontal) QWheelEvent.
        + The delivery of the second (Qt::Vertical) QWheelEvent is performed at qapplication_mac.mm:2198 ------ QApplication::sendSpontaneousEvent(widget, &qwe);
        without any additional check of the widget existence.

      See /src/gui/kernel/qcocoaview_mac.mm:901 for Cocoa implementation of QWheelEvent delivery.

      • (void)scrollWheel:(NSEvent *)theEvent implementation seems to have a similar problem.

      See attachments:
      1. QtEventDispatchingTest.cpp - Test sample for reproducing this issue. Usage:
      + Launch the sample.
      + Put the input focus into the "Monitored widget".
      + Scroll this widget with Mac Multi-touch TrackPad in both direction (Horz & Vert.)

      • The Test sample will crash.
        2. CrashReport_Carbon.html - Crash report of the Test sample, which was built against Carbon Qt
        3. CrashReport_Cocoa.html - Crash report of the Test sample, which was built against Cocoa Qt

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            sshurick Alexander Semenkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes