Test for nullptr before dereferencing the screen
Touch event processing might still be ongoing even after the screen has been disconnected. If that screen was also the primary screen, we would dereference nullptr. Check for nullptr to avoid potential crashes during shutdown. Fixes: QTBUG-95192 Pick-to: 6.2 5.15 Change-Id: I49ccd30c4126fe12cf5bb675e532e6e59b40b9c1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
e65c29fffc
commit
30b0b72453
@ -757,7 +757,7 @@ QRect QEvdevTouchScreenData::screenGeometry() const
|
||||
if (m_screen)
|
||||
screen = m_screen;
|
||||
}
|
||||
return QHighDpi::toNativePixels(screen->geometry(), screen);
|
||||
return screen ? QHighDpi::toNativePixels(screen->geometry(), screen) : QRect();
|
||||
}
|
||||
|
||||
void QEvdevTouchScreenData::reportPoints()
|
||||
|
@ -84,7 +84,7 @@ QRect QLibInputTouch::screenGeometry(DeviceState *state)
|
||||
if (m_screen)
|
||||
screen = m_screen;
|
||||
}
|
||||
return QHighDpi::toNativePixels(screen->geometry(), screen);
|
||||
return screen ? QHighDpi::toNativePixels(screen->geometry(), screen) : QRect();
|
||||
}
|
||||
|
||||
QPointF QLibInputTouch::getPos(libinput_event_touch *e)
|
||||
|
Loading…
Reference in New Issue
Block a user