From: Debian Qt/KDE Maintainers Date: Sun, 28 Apr 2024 18:48:02 +0000 (+0200) Subject: set geometry property in QXcbWindow after checking minimum size X-Git-Tag: archive/raspbian/5.15.8+dfsg-11+rpi1+deb12u2^2~27 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f26cec76950f2481d3bced31f612e2762d48074e;p=qtbase-opensource-src.git set geometry property in QXcbWindow after checking minimum size Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=6a3627b6c5aa5109 Last-Update: 2023-01-04 QXcbWindow::create() bound the window's size to windowMinimumSize(), after its size had been inherited from parent(). QPlatformWindow::setGeometry() was called before that sanity check. When a fullscreen window is re-mapped from a deactivated screen to the remaining screen, the call to QPlatformWindow::setGeometry() assigns an invalid QRect to QPlatformWindowPrivate::rect The negative int values x2 and/or y2 cause QXcbBackingStoreImage::flushPixmap to address unmapped memory and crash. This patch moves the call to QPlatformWindow::setGeometry() from before to after bounding to a minimum value. That assures a valid rectangle to be assigned in all cases. Gbp-Pq: Name qxcbwindow_set_geometry.diff --- diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 609e8ac56..abcdce034 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -299,11 +299,6 @@ void QXcbWindow::create() return; } - QPlatformWindow::setGeometry(rect); - - if (platformScreen != currentScreen) - QWindowSystemInterface::handleWindowScreenChanged(window(), platformScreen->QPlatformScreen::screen()); - const QSize minimumSize = windowMinimumSize(); if (rect.width() > 0 || rect.height() > 0) { rect.setWidth(qBound(1, rect.width(), XCOORD_MAX)); @@ -315,6 +310,11 @@ void QXcbWindow::create() rect.setHeight(QHighDpi::toNativePixels(int(defaultWindowHeight), platformScreen->QPlatformScreen::screen())); } + QPlatformWindow::setGeometry(rect); + + if (platformScreen != currentScreen) + QWindowSystemInterface::handleWindowScreenChanged(window(), platformScreen->QPlatformScreen::screen()); + xcb_window_t xcb_parent_id = platformScreen->root(); if (parent()) { xcb_parent_id = static_cast(parent())->xcb_window();