summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorDamian Jansen <damian.jansen@nokia.com>2011-11-15 04:01:13 (GMT)
committerDamian Jansen <damian.jansen@nokia.com>2011-11-15 04:01:13 (GMT)
commitee60e9c88c43cc33dc94a4cec79c62ffdf02ce58 (patch)
treed30647289c3c80eca7d34ab85366ef95a0ccb274 /src/gui/graphicsview
parent7a0cdd851d8ea1e2b51d3b91dbb69a67d379b794 (diff)
downloadQt-ee60e9c88c43cc33dc94a4cec79c62ffdf02ce58.zip
Qt-ee60e9c88c43cc33dc94a4cec79c62ffdf02ce58.tar.gz
Qt-ee60e9c88c43cc33dc94a4cec79c62ffdf02ce58.tar.bz2
Fix focusScopeItemChange setting crash
Delay focusScopeItemChange to after reparenting, to prevent an invalid focusScopeItem pointer crash. Task-number: QTBUG-21640 Reviewed-by: Martin Jones
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 466cc47..9e1fd09 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1157,7 +1157,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) {
parentFocusScopeItem = fsi;
p->d_ptr->focusScopeItem = 0;
- fsi->d_ptr->focusScopeItemChange(false);
}
break;
}
@@ -1259,6 +1258,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
if (!inDestructor && (transformData || (newParent && newParent->d_ptr->transformData)))
transformChanged();
+ // Reparenting is finished, now safe to notify the previous focusScopeItem about changes
+ if (parentFocusScopeItem)
+ parentFocusScopeItem->d_ptr->focusScopeItemChange(false);
+
// Restore the sub focus chain.
if (subFocusItem) {
subFocusItem->d_ptr->setSubFocus(newParent);