From d724c91a0ae9ed38fd2dc33bcdd4edbe6aa69085 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 7 Sep 2009 15:15:34 +0200 Subject: Fix crash on QGraphicsItem destruction related to focus handling Do not call clearFocus() for child item in setParentItemHelper() if called from destructor: At this time, the ~QGraphicsItem destructor already deleted all its children. Reviewed-by: Andreas Aardal Hanssen --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index eae3e63..7023e9e 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) { + if (subFocusItem && !inDestructor) { // 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. -- cgit v0.12