diff --git a/src/wayland/seat.cpp b/src/wayland/seat.cpp index 9698156f6f..1b854d7993 100644 --- a/src/wayland/seat.cpp +++ b/src/wayland/seat.cpp @@ -255,14 +255,14 @@ void SeatInterfacePrivate::registerPrimarySelectionDevice(PrimarySelectionDevice void SeatInterfacePrivate::cancelDrag() { - if (drag.target) { - drag.target->updateDragTarget(nullptr, 0); - drag.target = nullptr; - } QObject::disconnect(drag.dragSourceDestroyConnection); if (drag.source) { drag.source->dndCancelled(); } + if (drag.target) { + drag.target->updateDragTarget(nullptr, 0); + drag.target = nullptr; + } drag = Drag(); Q_EMIT q->dragSurfaceChanged(); Q_EMIT q->dragEnded();