qt5base-lts/tests/auto/widgets
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
..
dialogs Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
effects Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
graphicsview unblacklist passing tests 2022 2022-06-23 01:36:01 +02:00
itemviews Fix memory leak in tst_qtreewidget 2022-05-18 10:58:05 +00:00
kernel Harden drag and drop handling in widget window 2022-07-01 22:38:45 +00:00
styles Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
util Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
widgets QKeySequenceEdit: add a maximumSquenceLength property 2022-06-27 12:02:47 +00:00
CMakeLists.txt Begin port of qtbase to CMake 2018-11-01 11:48:46 +00:00