diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2009-09-08 08:48:36 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2009-09-08 08:51:18 (GMT) |
commit | 8a12dd9ab4cb026591a6d9672d147ec4eb54a651 (patch) | |
tree | e6abf402ef6862a756acecbd0841e9ff2e611039 /src | |
parent | a5b44447698afea24a5a691e4df852428a75d366 (diff) | |
download | Qt-8a12dd9ab4cb026591a6d9672d147ec4eb54a651.zip Qt-8a12dd9ab4cb026591a6d9672d147ec4eb54a651.tar.gz Qt-8a12dd9ab4cb026591a6d9672d147ec4eb54a651.tar.bz2 |
Fix crash on QGraphicsItem destruction related to focus handling (redone)
Reset the dangling subFocusItem pointer in ~QGraphicsItem,
after all the child items have been deleted.
This replaces commit d724c91a0ae.
Reviewed-by: Thomas Hartmann
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 8bd3648..73ea75e 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -930,7 +930,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) } QGraphicsItem *lastSubFocusItem = subFocusItem; - if (subFocusItem && !inDestructor) { + if (subFocusItem) { // Update the child focus chain; when reparenting an item that has a // focus child, ensure that that focus child clears its focus child // chain from our parents before it's reparented. @@ -1204,6 +1204,8 @@ QGraphicsItem::~QGraphicsItem() Q_ASSERT(d_ptr->children.isEmpty()); } + d_ptr->subFocusItem = 0; + if (d_ptr->scene) { d_ptr->scene->d_func()->removeItemHelper(this); } else { |