xcb: check validity of RandR output info before using it

Fixes: QTBUG-128906
Pick-to: 6.5 6.2 5.15
Change-Id: Ibafdf4bb9c449b29437b0520299ab407238e5703
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 439e19be17b9169f5786b2593e6d1ac6978bb84b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 21098bbb9c61bbc3c5dd441b67043a483e7e8a21)
This commit is contained in:
Liang Qi 2024-09-16 11:14:15 +02:00 committed by Qt Cherry-pick Bot
parent 6360837751
commit 986f620e48

View File

@ -140,7 +140,7 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
// Screen has been disabled
auto outputInfo = Q_XCB_REPLY(xcb_randr_get_output_info, xcb_connection(),
output.output, output.config_timestamp);
if (outputInfo->crtc == XCB_NONE) {
if (!outputInfo || outputInfo->crtc == XCB_NONE) {
qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled";
destroyScreen(screen);
} else {