From 9786ea3c58634e7c96974040ebf074918311f0e7 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 11 Mar 2021 01:34:03 +0100 Subject: [PATCH] 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). --- src/touch_input.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/touch_input.cpp b/src/touch_input.cpp index fa8744f20f..8a3c845c82 100644 --- a/src/touch_input.cpp +++ b/src/touch_input.cpp @@ -195,13 +195,15 @@ void TouchInputRedirection::cancel() // 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, // the compositor will not receive any TOUCH_MOTION or TOUCH_UP events for that slot. - m_activeTouchPoints.clear(); - waylandServer()->seat()->cancelTouchSequence(); + if (!m_activeTouchPoints.isEmpty()) { + m_activeTouchPoints.clear(); + waylandServer()->seat()->cancelTouchSequence(); + } } void TouchInputRedirection::frame() { - if (!inited()) { + if (!inited() || !waylandServer()->seat()->hasTouch()) { return; } waylandServer()->seat()->touchFrame();