data-device: properly abort drag on missing device

sometimes there is no focused device (e.g. when dnd'ing on nothing or xwayland) in which case abort would fail to send cancelled to the source.

ref #6543
This commit is contained in:
Vaxry 2024-06-16 20:56:50 +02:00
parent 172ee1cada
commit d5ef10abf4

View file

@ -644,10 +644,12 @@ void CWLDataDeviceProtocol::abortDrag() {
g_pInputManager->unsetCursorImage();
dnd.overriddenCursor = false;
if (!dnd.focusedDevice || !dnd.currentSource)
if (!dnd.focusedDevice && !dnd.currentSource)
return;
if (dnd.focusedDevice)
dnd.focusedDevice->sendLeave();
if (dnd.currentSource)
dnd.currentSource->cancelled();
dnd.focusedDevice.reset();