-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
4.5.0, 4.5.1, 4.5.2, 4.5.3
-
None
Bug was reported already at the old Task tracker and has Id
256731 - crash problem in QWidgetPrivate::hide_sys (qwidget_mac.mm)
I repeat it here as we did not get any response for that.
We get a crash problem when hiding/closing widgets in a certain order on Mac OSX.
Compile and run the attached small sample program.
click ASAP in the middle of the app and wait until the QLineEdit field was destroyed.
After that move the mouse a bit -> crash.
Explanation: 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 the mouse is over a widget when we call 'hide' . 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.
The developer thought that the QPointer solves the problem of potential invalid widgets however the internal usage turned this into a trap.
The fix is to reset qt_mouseover in QWidget::destroy.
We use the fix internally already some months without problems (1200 automatic test cases daily)attached in the patch.
- is replaced by
-
QTBUG-4227 crash problem in QWidgetPrivate::hide_sys (qwidget_mac.mm)
-
- Closed
-