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,11 +644,13 @@ void CWLDataDeviceProtocol::abortDrag() {
g_pInputManager->unsetCursorImage();
dnd.overriddenCursor = false;
if (!dnd.focusedDevice || !dnd.currentSource)
if (!dnd.focusedDevice && !dnd.currentSource)
return;
dnd.focusedDevice->sendLeave();
dnd.currentSource->cancelled();
if (dnd.focusedDevice)
dnd.focusedDevice->sendLeave();
if (dnd.currentSource)
dnd.currentSource->cancelled();
dnd.focusedDevice.reset();
dnd.currentSource.reset();