summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-03-22 07:04:46 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-03-24 08:29:00 (GMT)
commitb6b1dee9460d6fdde0b8ad005301c0a315ad30bf (patch)
tree688822268433c0c37a7d8282a132a450b1150f03 /src
parent67dd6de344710d1c0a21e9dbc803a1d0c95e05b7 (diff)
downloadQt-b6b1dee9460d6fdde0b8ad005301c0a315ad30bf.zip
Qt-b6b1dee9460d6fdde0b8ad005301c0a315ad30bf.tar.gz
Qt-b6b1dee9460d6fdde0b8ad005301c0a315ad30bf.tar.bz2
Fix a crash when reparenting an item in QGraphicsView.
Before calling addItem we need to invalidate the depth otherwise if someone call anything relating to sorting when itemChange is called (because of the scene change for instance) then qt_closestItemFirst for example can crash because of an invalid state. Task-number:QTBUG-6932 Reviewed-by:janarve
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index f3c90ca..9852323 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1130,6 +1130,9 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
}
}
+ // Resolve depth.
+ invalidateDepthRecursively();
+
if ((parent = newParent)) {
if (parent->d_func()->scene && parent->d_func()->scene != scene) {
// Move this item to its new parent's scene
@@ -1180,8 +1183,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
}
}
- // Resolve depth.
- invalidateDepthRecursively();
dirtySceneTransform = 1;
// Restore the sub focus chain.