Skip to content

Commit

Permalink
xcb: try to repopulate xinput2 devices when needed
Browse files Browse the repository at this point in the history
And try to not call Q_ASSERT() to avoid crash.

Fixes: QTBUG-123554
Pick-to: 6.7 6.6 6.5
Change-Id: I9443c5f0ab4ca7a858df9b328f517b48ab8f122d
Reviewed-by: Axel Spoerl <[email protected]>
Reviewed-by: Allan Sandfeld Jensen <[email protected]>
  • Loading branch information
liangqi committed Mar 22, 2024
1 parent 6f68cb9 commit 2862cdb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,16 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
{
auto *xiDeviceEvent = reinterpret_cast<xcb_input_touch_begin_event_t *>(xiDevEvent);
TouchDeviceData *dev = touchDeviceForId(xiDeviceEvent->sourceid);
Q_ASSERT(dev);
if (!dev) {
qCDebug(lcQpaXInputEvents) << "didn't find the dev for given sourceid - " << xiDeviceEvent->sourceid
<< ", try to repopulate xi2 devices";
xi2SetupDevices();
dev = touchDeviceForId(xiDeviceEvent->sourceid);
if (!dev) {
qCDebug(lcQpaXInputEvents) << "still can't find the dev for it, give up.";
return;
}
}
const bool firstTouch = dev->touchPoints.isEmpty();
if (xiDeviceEvent->event_type == XCB_INPUT_TOUCH_BEGIN) {
QWindowSystemInterface::TouchPoint tp;
Expand Down

0 comments on commit 2862cdb

Please sign in to comment.