set geometry property in QXcbWindow after checking minimum size
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Sat, 17 Feb 2024 12:11:37 +0000 (15:11 +0300)
committerDmitry Shachnev <mitya57@debian.org>
Sat, 17 Feb 2024 12:11:37 +0000 (15:11 +0300)
commitab62514d1220807ef530aa7509a3c3cfc282e898
treee275e632413f8ca40fe4c3a1077b20174c2d69c3
parent9798c0044b81b488a7c391f9ce2ca92f0fa01254
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