Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.8.1
-
MSVC
-
-
81ed068a5 (dev), ccbf28a56 (6.9), 39ba5ed46 (6.8), 702acf9bf (tqtc/lts-6.5)
Description
My app uses multiple floating QDockWidgets. When they are combined, a crash occurs.
I will walk through the stack since I am unable to create a repro case.
See the video for how crash is reproduced.
Here is the complete stack
It is a mouse event
Farther down we sent event to the receiver
The receiver is QDockWidgetGroupWindow
QDockWidgetGroupWindow treats it as a windowEvent
Which is handled by QMainWindowLayoutSeparatorHelper as a HoverMove and adjustCursor is called
adjustCursor call findSeparator
Which calls toolBarAreaLayout
At this point, you can see that mainWindow is derived from QDockWidgetGroupWindow
Now we cast the parentWidget to QMainWindow, when it is not a QMainWindow
auto mainWindow = static_cast<QMainWindow>(parentWidget());
After this, it crashes. 'd' is not valid after this cast
QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *mainWindow)
{ return QMainWindowPrivate::mainWindowLayout(mainWindow); }
static inline QMainWindowLayout *mainWindowLayout(const QMainWindow *mainWindow)