summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2011-05-26 11:56:54 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2011-05-26 14:21:20 (GMT)
commit6c10e72fc838f8f9f5c3a3e4a297088b1725262c (patch)
tree4ef2188f5d2320e8b1a275f63b8cb4b33bf25a09 /src/gui/kernel
parent4a7b3a10da5b3bd63b6f8a6c0cc53ee22c60fe60 (diff)
downloadQt-6c10e72fc838f8f9f5c3a3e4a297088b1725262c.zip
Qt-6c10e72fc838f8f9f5c3a3e4a297088b1725262c.tar.gz
Qt-6c10e72fc838f8f9f5c3a3e4a297088b1725262c.tar.bz2
Fix infinite recursion when changing geometry on Mac
Some complex widgets might get a negatively sized rectangle when calling QWidgetPrivate:setGeometry_sys_helper(), triggering a infinite recursion. Normalizing the rectangle size before checking for size change is enough to break this infinite recursion. Reviewed-by: Richard Task-number: QTBUG-17333
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwidget_mac.mm12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 2f33f55..9481a85 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4434,6 +4434,11 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
QPoint oldp = q->pos();
QSize olds = q->size();
+ // Apply size restrictions, applicable for Windows & Widgets.
+ if (QWExtra *extra = extraData()) {
+ w = qBound(extra->minw, w, extra->maxw);
+ h = qBound(extra->minh, h, extra->maxh);
+ }
const bool isResize = (olds != QSize(w, h));
if (!realWindow && !isResize && QPoint(x, y) == oldp)
@@ -4443,13 +4448,6 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
data.window_state = data.window_state & ~Qt::WindowMaximized;
const bool visible = q->isVisible();
- // Apply size restrictions, applicable for Windows & Widgets.
- if (QWExtra *extra = extraData()) {
- w = qMin(w, extra->maxw);
- h = qMin(h, extra->maxh);
- w = qMax(w, extra->minw);
- h = qMax(h, extra->minh);
- }
data.crect = QRect(x, y, w, h);
if (realWindow) {