diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-04 02:45:10 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-04 02:45:10 (GMT) |
commit | 7f2c9d716cba375ee3e576513898a39b3f2c39a5 (patch) | |
tree | f1fad8c30b7dcd07961c7e318376453845f40907 /src/gui/graphicsview | |
parent | a0b531163a79c9097185b580fdf4aa8157cead41 (diff) | |
download | Qt-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/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 5 |
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(); |