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
This commit is contained in:
Vlad Zahorodnii 2023-02-22 21:35:26 +02:00
parent 520fa3042a
commit da26deaa5c

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: {