Go to file
Thomas Fischer 983dde1f2f Avoid adding widget to its own layout
Widgets and layouts added or inserted to a layout are checked for:
- Not being NULL
- Not being the parent widget of a layout or the layout itself,
  respectively

Without this commit, adding a widget to its own layout would result in a
CPU-hogging infinite loop. Now, a warning is written to stderr and the
add or insert function call is ignored.

The checks are implemented as public functions of QLayoutPrivate and
thus accessible in QLayout's descendants to be used in various
"addWidget", "insertWidget", etc functions.

Unlike 'classical' layouts like QGridLayout, QFormLayout does indeed
accept widgets that are NULL. To not break this behavior, any call for
the check functions first tests if the widget or layout, respectively,
to test is NULL or not and calls the check only in the latter case.

Automated tests for QBoxLayout, QGridLayout, and QFormLayout were added.
For an unpatched Qt 5.3, each of those automated tests will freeze as
explained in QTBUG-40609. For a fixed version, warning messages about
invalid parameters to addWidget/addLayout/... calls will be read by
QTest::ignoreMessage, resulting in a passed test.

Change-Id: I1522d5727e643da3f7c025755975aca9f482676d
Task-number: QTBUG-40609
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-09-05 00:05:45 +02:00
bin automate handling of generated headers some more 2014-02-28 03:17:11 +01:00
config.tests Create the 64 bits version strings for MIPS, SPARC and S390 2014-06-27 03:02:53 +02:00
dist Add empty changes-5.3.2 file 2014-08-26 15:07:33 +02:00
doc Merge remote-tracking branch 'origin/release' into stable 2014-05-12 14:01:46 +02:00
examples fingerpaint example: be sensitive to pressure only when supported 2014-08-18 15:38:21 +02:00
lib Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
mkspecs Do not set QMAKE_{INC,LIB}DIR_{OPENGL,X11} in the freebsd mkspecs. 2014-08-15 19:54:02 +02:00
qmake qmake: Document the "aux" template type. 2014-07-25 09:24:39 +02:00
src Avoid adding widget to its own layout 2014-09-05 00:05:45 +02:00
tests Avoid adding widget to its own layout 2014-09-05 00:05:45 +02:00
tools pass --sysroot to compile tests also on windows 2014-08-01 14:37:37 +02:00
util Introduce QChar::JoiningType enum and QChar::joiningType() method 2014-01-29 23:19:47 +01:00
.gitattributes Update the git-archive export options 2012-09-07 15:39:31 +02:00
.gitignore Add .dylib and .d to .gitignore 2014-03-29 00:40:46 +01:00
.qmake.conf Enable -Werror for all of qtbase 2013-09-04 01:50:10 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
configure Improve dbus cross compilation 2014-07-28 14:08:22 +02:00
configure.bat get rid of syncqt wrapper scripts 2013-05-13 21:54:48 +02:00
header.BSD Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
header.FDL Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
header.LGPL Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
header.LGPL-ONLY Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
INSTALL Doc: Update links in INSTALL file 2014-01-16 20:37:25 +01:00
LGPL_EXCEPTION.txt Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
LICENSE.FDL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.GPL Add the LICENSE.GPL file to the module referenced from license headers 2012-05-20 22:41:08 +02:00
LICENSE.LGPL Update copyright year in LICENSE.LGPL 2014-03-31 12:36:33 +02:00
LICENSE.PREVIEW.COMMERCIAL Update LICENSE.PREVIEW.COMMERCIAL license 2013-06-03 20:04:26 +02:00
qtbase.pro untangle use of system vs. shell path(-list) semantics 2014-04-30 16:56:54 +02:00
sync.profile generate QGL header file from qgl.h 2014-07-18 14:54:11 +02:00