input: prevent seat touch methods from being called when there's no touch

Otherwise we get a crash as we are asserting with Q_ASSERT(d->touch).
This commit is contained in:
Aleix Pol 2021-03-11 01:34:03 +01:00 committed by Aleix Pol Gonzalez
parent 58debd72a3
commit 9786ea3c58

View file

@ -195,13 +195,15 @@ void TouchInputRedirection::cancel()
// up events will be silently ignored and won't be passed down through the event filter chain. // up events will be silently ignored and won't be passed down through the event filter chain.
// If the touch sequence is cancelled because we received a TOUCH_CANCEL event from libinput, // If the touch sequence is cancelled because we received a TOUCH_CANCEL event from libinput,
// the compositor will not receive any TOUCH_MOTION or TOUCH_UP events for that slot. // the compositor will not receive any TOUCH_MOTION or TOUCH_UP events for that slot.
m_activeTouchPoints.clear(); if (!m_activeTouchPoints.isEmpty()) {
waylandServer()->seat()->cancelTouchSequence(); m_activeTouchPoints.clear();
waylandServer()->seat()->cancelTouchSequence();
}
} }
void TouchInputRedirection::frame() void TouchInputRedirection::frame()
{ {
if (!inited()) { if (!inited() || !waylandServer()->seat()->hasTouch()) {
return; return;
} }
waylandServer()->seat()->touchFrame(); waylandServer()->seat()->touchFrame();