Don't process pad button events from a device that has been removed
This fixes a rare crash where we may dereference a null TabletV2Interface in findAndAdoptPad. This can happen because the underlying device disappears, and we call libinput_device_group_set_user_data (what tabletPadId.data points to) to reset the user data to null. Similar to what we do to tablet tool events (see tabletToolEvent), we should check if this is null before continuing. Fixes KWIN-3R6
This commit is contained in:
parent
087b2c290f
commit
9f6c969aba
1 changed files with 6 additions and 0 deletions
|
@ -2399,7 +2399,13 @@ public:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: tablet may be nullptr when the device is removed (see ::removeDevice) but events from the tool
|
||||||
|
// may still happen.
|
||||||
auto tablet = static_cast<TabletV2Interface *>(tabletPadId.data);
|
auto tablet = static_cast<TabletV2Interface *>(tabletPadId.data);
|
||||||
|
if (!tablet) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
SurfaceInterface *surface = window->surface();
|
SurfaceInterface *surface = window->surface();
|
||||||
auto pad = tablet->pad();
|
auto pad = tablet->pad();
|
||||||
if (!pad) {
|
if (!pad) {
|
||||||
|
|
Loading…
Reference in a new issue