set geometry property in QXcbWindow after checking minimum size
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Sat, 13 Jan 2024 16:53:52 +0000 (19:53 +0300)
committerDmitry Shachnev <mitya57@debian.org>
Sat, 13 Jan 2024 16:53:52 +0000 (19:53 +0300)
commit4d66fbe01a939b42cc7fcbc9fc40e74024767b5b
tree467d15da1f2ff9c54ecd5b6267dd1961b00cc126
parent6ddaafb12c0bd65d8ce224223dfea06808a6144f
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
src/plugins/platforms/xcb/qxcbwindow.cpp