Be more graceful when objects die by the time the dnd loop exits
The main issue fixed in 7f23dd963536eb8123ee4c5c22bf43b6f866d008 can manifest in another form on platforms where QBasicDrag is used (xcb). Make sure that we recognize if an object (e.g. a QWidgetWindow) is destroyed by the time the nested event loop exits. Task-number: QTBUG-104596 Change-Id: Ib82dd8230cb6f13d804bd992234b2a3ce85a7061 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 742ae9ea1cadbb438e2d02bb58ae900c676dc41c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
fe6f7de8ce
commit
c514812aaf
@ -124,6 +124,7 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
|
||||
}
|
||||
case QEvent::MouseButtonRelease:
|
||||
{
|
||||
QPointer<QObject> objGuard(o);
|
||||
disableEventFilter();
|
||||
if (canDrop()) {
|
||||
QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window);
|
||||
@ -133,6 +134,8 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
|
||||
cancel();
|
||||
}
|
||||
exitDndEventLoop();
|
||||
if (!objGuard)
|
||||
return true;
|
||||
|
||||
// If a QShapedPixmapWindow (drag feedback) is being dragged along, the
|
||||
// mouse event's localPos() will be relative to that, which is useless.
|
||||
|
Loading…
x
Reference in New Issue
Block a user