diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2011-05-26 15:12:48 +0200 |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-05-26 20:39:30 +0200 |
commit | d49973f834fb73c534275f5b1d508329638e2823 (patch) | |
tree | c11baf84bd5ac034ab0dfed90c47d2b9fa2e7e06 /src/gui | |
parent | bbbea1fa966525ae8417297ce5579c5f2011ad2c (diff) |
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.
Task-number: QTBUG-17333
Change-Id: I4682c3088ea53fb9f28f746c8264f573b5284825
Reviewed-on: http://codereview.qt.nokia.com/156
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 9a873f32ac..3a025e9237 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4541,6 +4541,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) @@ -4550,13 +4555,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) { |