summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-08-04 02:45:10 (GMT)
committerToby Tomkins <toby.tomkins@nokia.com>2010-08-06 03:43:16 (GMT)
commit2a771a1b04a58d1f13021b280a9ecf0e5c1476ab (patch)
tree90a3372ea6f72b20c7a84ddffb275dc3df099840
parent94b2f7580ad9f5460eccf51e999ad9b39c70aa9f (diff)
downloadQt-2a771a1b04a58d1f13021b280a9ecf0e5c1476ab.zip
Qt-2a771a1b04a58d1f13021b280a9ecf0e5c1476ab.tar.gz
Qt-2a771a1b04a58d1f13021b280a9ecf0e5c1476ab.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 (cherry picked from commit 7f2c9d716cba375ee3e576513898a39b3f2c39a5)
-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();