From 8825c01b15a3ca850cc0fa565f1c2fa483df6bbe Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 17 Sep 2021 15:01:30 +0200 Subject: [PATCH] tablet: Fix disconnecting the tablet while the pen is still in proximity libinput will send release and proximity out events after the device is disconnected. This just takes into account that tablet might be nullptr. BUG: 442573 --- src/input.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/input.cpp b/src/input.cpp index 1a6d40e3be..56522ba98b 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1774,6 +1774,8 @@ public: tool = createTool(event->tabletId()); } + // NOTE: tablet will be nullptr as the device is removed (see ::removeDevice) but events from the tool + // may still happen (e.g. Release or ProximityOut events) auto tablet = static_cast(event->tabletId().m_deviceGroupData); Toplevel *toplevel = input()->findToplevel(event->globalPos()); @@ -1784,7 +1786,7 @@ public: KWaylandServer::SurfaceInterface *surface = toplevel->surface(); tool->setCurrentSurface(surface); - if (!tool->isClientSupported() || !tablet->isSurfaceSupported(surface)) { + if (!tool->isClientSupported() || (tablet && !tablet->isSurfaceSupported(surface))) { return emulateTabletEvent(event); }