qt6-bb10/tests/auto/widgets/kernel
Laszlo Agocs dab0ef3670 Harden drag and drop handling in widget window
User code in an event handler can do arbitrary things, including
operations that lead to destroying the QWidgetWindow. An example is
what the autotest does: reparenting the top-level widget to under
another top-level upon the drop. Internally this leads to destroying
the drop target's QWidgetWindow as the widget is now a child, not a
top-level.

In fact some of the existing drag and drop handling code seems to be
prepared to handle the case of having the drag target widget destroyed
in the user's event handler during a drag-move. But none of it is
prepared for having the QWidgetWindow destroyed upon returning from
forwardEvent().

The associated bug report has the same root cause, it is just popping up
now via the new 6.4 behavior: adding a QOpenGLWidget to a widget
hierarchy upon a drop leads to getting a new QWidgetWindow (if the
window only had regular raster widgets before).

To solve this, avoid touching members on 'this' after the
forwardEvent(). It looks like the handlers for mouse events follow
this pattern already, no member data is touched after forwarding events
(not sure if that is intentional or just incidental but it is the safe
solution, even if this is not feasible everywhere, but ideally input
events should take this into account).

Fixes: QTBUG-104596
Pick-to: 6.4 6.3 6.2
Change-Id: I96c704cadcd799fc5619b776e939dfdf313a27dd
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-01 22:38:45 +00:00
..
qaction Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qactiongroup Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qapplication BLACKLIST tst_QApplication::sendEventsOnProcessEvents for Ubuntu 22.04 2022-06-20 20:06:20 +03:00
qboxlayout QLayout: add className() to a warning message 2022-07-01 18:19:46 +00:00
qformlayout QLayout: add className() to a warning message 2022-07-01 18:19:46 +00:00
qgesturerecognizer xcb: Delete touch points without target windows 2022-05-20 10:26:18 +02:00
qgridlayout Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qlayout Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qshortcut Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsizepolicy Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qstackedlayout Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtooltip Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwidget IM: Don't let all widgets support IM by default 2022-07-01 10:47:17 +02:00
qwidget_window Harden drag and drop handling in widget window 2022-07-01 22:38:45 +00:00
qwidgetaction Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwidgetmetatype Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwidgetrepaintmanager Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwidgetsvariant Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwindowcontainer Fix separate delete of window and windowcontainer 2022-05-23 21:25:46 +02:00
CMakeLists.txt Android: activate tst_QWidget 2022-03-29 13:56:14 +01:00