backends/libinput: Fix crash upon receiving motion absolute events

The input events can be processed when the workspace is not available,
e.g. during startup or shutdown, so add a corresponding guard.

As a long term plan, we need to decouple Workspace from low-level input
backend parts, but it will be a too invasive change for now.

BUG: 449317
BUG: 465456


(cherry picked from commit da26deaa5c843ef303ef9f1b9f0cd3d341c5c5f5)
icc-effect-5.27.2
Vlad Zahorodnii 2023-02-22 21:35:26 +02:00
parent 5b777e9fb6
commit 6970199ccc
1 changed files with 3 additions and 1 deletions

View File

@ -373,7 +373,9 @@ void Connection::processEvents()
}
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: {
PointerEvent *pe = static_cast<PointerEvent *>(event.get());
Q_EMIT pe->device()->pointerMotionAbsolute(pe->absolutePos(workspace()->geometry().size()), pe->time(), pe->device());
if (workspace()) {
Q_EMIT pe->device()->pointerMotionAbsolute(pe->absolutePos(workspace()->geometry().size()), pe->time(), pe->device());
}
break;
}
case LIBINPUT_EVENT_TOUCH_DOWN: {