diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-12-11 14:36:13 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-12-11 14:36:13 (GMT) |
commit | 0fecf4184e888b202766210b235fde09a81c5257 (patch) | |
tree | 1abedfd00c759ab40c1992a4a1341b7f7275fd0f /src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | |
parent | 3a8a1f83d60ec16e4c61e2b0a327a5af02917a5a (diff) | |
download | Qt-0fecf4184e888b202766210b235fde09a81c5257.zip Qt-0fecf4184e888b202766210b235fde09a81c5257.tar.gz Qt-0fecf4184e888b202766210b235fde09a81c5257.tar.bz2 |
Add a simple check for a common wrong usage to avoid infinite recursion
Reviewed-by: Alexis
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout_p.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 03ed63d..1dc6873 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1666,6 +1666,13 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi return 0; } + const QGraphicsLayoutItem *parentWidget = q->parentLayoutItem(); + if (firstItem == parentWidget || secondItem == parentWidget) { + qWarning("QGraphicsAnchorLayout::addAnchor(): " + "You cannot add the parent of the layout to the layout."); + return 0; + } + // In QGraphicsAnchorLayout, items are represented in its internal // graph as four anchors that connect: // - Left -> HCenter |