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

crash problem in QWidgetPrivate::hide_sys (qwidget_mac.mm)

XMLWordPrintable

    • macOS
    • 36a2b5f899b35d4ed14f4c6a229c7888e10c5fd8, b9da3c5129b8c24e89db1f349587c6b72bfe5876

      There is a potential crash problem when hiding/closing widgets in a certain order on Mac OSX.

      Calling QWidget::hide crashes because of an invalid "qt_mouseover" variable defined as
      extern QPointer<QWidget> qt_mouseover; //qapplication_mac.mm:line 190

      qt_mouseover is set in the QWidget::hide_sys function as a result of QApplication::widgetAt(QCursor::pos());

      The problem occurs when mousing over a widget as it is hiding. A previous call to hide_sys executes the QWidget::destroy code (the mouse is over a widget which is half dead) twice.

      That means that QObjectPrivate::clearGuards has been already called for that particular widget and qt_mouseover holds an invalid pointer.

      The next call to hide_sys tries to do something with qt_mouseover in dispatchEnterLeave and crashes.

      Now qt_mouseover still holds a reference to the already deleted DockWindow widget. The next call to hide_sys (doesn't matter for which widget) crashes

      Program received signal EXC_BAD_ACCESS, Could not access memory.
      Reason: KERN_PROTECTION_FAILURE at address: 0x00000001
      0x050aad7d in QWidgetPrivate::hide_sys (this=0x1f0c6d80) at kernel/qwidget_mac.mm:3398

      (gdb) bt
      #0 0x050aad7d in QWidgetPrivate::hide_sys (this=0x1f0c6d80) at kernel/qwidget_mac.mm:3398
      #1 0x051590f5 in QWidgetPrivate::hide_helper (this=0x1f0c6d80) at kernel/qwidget.cpp:6804
      #2 0x05162bd7 in QWidget::setVisible (this=0x1f0c6d30, visible=false) at kernel/qwidget.cpp:6984
      #3 0x003c66d4 in QWidget::hide (this=0x1f0c6d30) at qwidget.h:477

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

            richard Richard Moe Gustavsen
            dettman Dean Dettman (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes