Skip to content

Commit

Permalink
xcb: guard crtc before usage
Browse files Browse the repository at this point in the history
Task-number: QTBUG-131343
Pick-to: 6.8 6.5
Change-Id: Ibcf96340e316b6fd667895dcd5d2cd6e4b55e012
Reviewed-by: David Redondo <qt@david-redondo.de>
  • Loading branch information
liangqi committed Nov 21, 2024
1 parent ea3288c commit f8aa1c4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/plugins/platforms/xcb/qxcbscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,12 +654,16 @@ void QXcbScreen::setMonitor(xcb_randr_monitor_info_t *monitorInfo, xcb_timestamp
if (m_crtcs.size() == 1) {
auto crtc = Q_XCB_REPLY(xcb_randr_get_crtc_info,
xcb_connection(), m_crtcs[0], timestamp);
m_singlescreen = (monitorGeometry == (QRect(crtc->x, crtc->y, crtc->width, crtc->height)));
if (m_singlescreen) {
if (crtc->mode) {
updateGeometry(QRect(crtc->x, crtc->y, crtc->width, crtc->height), crtc->rotation);
if (mode() != crtc->mode)
updateRefreshRate(crtc->mode);
if (crtc == XCB_NONE) {
qCDebug(lcQpaScreen, "Didn't get crtc info when m_crtcs.size() == 1");
} else {
m_singlescreen = (monitorGeometry == (QRect(crtc->x, crtc->y, crtc->width, crtc->height)));
if (m_singlescreen) {
if (crtc->mode) {
updateGeometry(QRect(crtc->x, crtc->y, crtc->width, crtc->height), crtc->rotation);
if (mode() != crtc->mode)
updateRefreshRate(crtc->mode);
}
}
}
}
Expand Down

0 comments on commit f8aa1c4

Please sign in to comment.