summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-08-04 02:45:10 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-08-04 02:45:10 (GMT)
commit7f2c9d716cba375ee3e576513898a39b3f2c39a5 (patch)
treef1fad8c30b7dcd07961c7e318376453845f40907 /src
parenta0b531163a79c9097185b580fdf4aa8157cead41 (diff)
downloadQt-7f2c9d716cba375ee3e576513898a39b3f2c39a5.zip
Qt-7f2c9d716cba375ee3e576513898a39b3f2c39a5.tar.gz
Qt-7f2c9d716cba375ee3e576513898a39b3f2c39a5.tar.bz2
Don't crash if an item is removed from the scene while it is gaining focus.
If the item is removed from the scene in response to the FocusOut event of the previous item don't continue attempting to set focus. Task-number: QTBUG-12620 Reviewed-by: Michael Brasser
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 48a0093..a98ce6f 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -831,6 +831,11 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
#endif //QT_NO_IM
}
+ // This handles the case that the item has been removed from the
+ // scene in response to the FocusOut event.
+ if (item && item->scene() != q)
+ item = 0;
+
if (item)
focusItem = item;
updateInputMethodSensitivityInViews();