diff options
author | Damian Jansen <damian.jansen@nokia.com> | 2011-11-15 04:01:13 (GMT) |
---|---|---|
committer | Damian Jansen <damian.jansen@nokia.com> | 2011-11-15 04:01:13 (GMT) |
commit | ee60e9c88c43cc33dc94a4cec79c62ffdf02ce58 (patch) | |
tree | d30647289c3c80eca7d34ab85366ef95a0ccb274 /src/gui/graphicsview | |
parent | 7a0cdd851d8ea1e2b51d3b91dbb69a67d379b794 (diff) | |
download | Qt-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.cpp | 5 |
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); |