summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2022-12-09 13:45:11 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-12-12 12:43:33 +0000
commit003d30fac2a75ee5f942917dbd4901536a742cbc (patch)
tree3d632c1ccf53378364fdb7100ee6e51a1079ebde /src/plugins
parent1d793e425cd4aae22b936c58e7a31393aef66869 (diff)
downloadqtbase-003d30fac2a75ee5f942917dbd4901536a742cbc.tar.gz
Set geometry property in QXcbWindow after checking minimum size
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. Fixes: QTBUG-109226 Change-Id: I349a0f3c721059a9013a275de5b4cb147fbdd7a1 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 6a3627b6c5aa5109a80024f3d7b0f938504f7ffe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 363ea29d14..be877f7e6c 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -253,11 +253,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));
@@ -269,6 +264,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<QXcbWindow *>(parent())->xcb_window();