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-09 06:52:18 (GMT) |
commit | eb3d5a73148cd7206c6b3b6672ed47b44611f745 (patch) | |
tree | 294fc3337577935048e044205efeddbf85c6c1f8 /src/gui | |
parent | b285f22389843925493be102b440dbd06c533878 (diff) | |
download | Qt-eb3d5a73148cd7206c6b3b6672ed47b44611f745.zip Qt-eb3d5a73148cd7206c6b3b6672ed47b44611f745.tar.gz Qt-eb3d5a73148cd7206c6b3b6672ed47b44611f745.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/gui')
-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 4fc0aed..d67011b 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -934,7 +934,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. @@ -1226,6 +1226,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 { |