From d49973f834fb73c534275f5b1d508329638e2823 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 26 May 2011 15:12:48 +0200 Subject: 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 --- tests/auto/qwidget/tst_qwidget.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/auto/qwidget/tst_qwidget.cpp') diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index f070d24ec3..eb110a246e 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -67,6 +67,7 @@ #include #include #include +#include #include #include @@ -403,6 +404,7 @@ private slots: void taskQTBUG_11373(); #endif // QT_MAC_USE_COCOA #endif + void taskQTBUG_17333_ResizeInfiniteRecursion(); void nativeChildFocus(); @@ -10464,6 +10466,18 @@ void tst_QWidget::taskQTBUG_11373() #endif // QT_MAC_USE_COCOA #endif +void tst_QWidget::taskQTBUG_17333_ResizeInfiniteRecursion() +{ + QTableView tb; + const char *s = "border: 1px solid;"; + tb.setStyleSheet(s); + tb.show(); + + QTest::qWaitForWindowShown(&tb); + tb.setGeometry(QRect(100, 100, 0, 100)); + // No crash, it works. +} + void tst_QWidget::nativeChildFocus() { QWidget w; -- cgit v1.2.3