summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscene.cpp
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-08-13 10:20:52 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-08-13 13:42:01 (GMT)
commitff01481900f1d19d392c8ed8fe0f3b5c85751b8e (patch)
tree7746aaea3d97643637096049ee5dcc12412b6657 /src/gui/graphicsview/qgraphicsscene.cpp
parent547af9bf8a2ec074a698f0b92ec9e2a1a935eb14 (diff)
downloadQt-ff01481900f1d19d392c8ed8fe0f3b5c85751b8e.zip
Qt-ff01481900f1d19d392c8ed8fe0f3b5c85751b8e.tar.gz
Qt-ff01481900f1d19d392c8ed8fe0f3b5c85751b8e.tar.bz2
Fix focus proxy deletion bugs/crashes in QGraphicsItem.
This change would have been much simpler if either QGraphicsItem inherited QObject, or if we had some similar QPointer-like class that supported QGraphicsItem. The issue is this: Each item can delegate another item to be its focus proxy. That item can be a parent or child, or something completely unrelated. Either of the two items can be deleted independently. The former solution was to store backpointers in a map in the scene. Problem is, the items may not be in a scene when this happens, they may be removed from the scene, and the items may be moved between two scenes. The bad part about this fix is that it adds another pointer to QGraphicsItemPrivate. Reviewed-by: Shane Kearns <shane.kearns@sosco.com>
Diffstat (limited to 'src/gui/graphicsview/qgraphicsscene.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index bdd1ac6..2178850 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -494,11 +494,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
item->d_func()->scene = 0;
// Unregister focus proxy.
- QMultiHash<QGraphicsItem *, QGraphicsItem *>::iterator it = focusProxyReverseMap.find(item);
- while (it != focusProxyReverseMap.end() && it.key() == item) {
- it.value()->d_ptr->focusProxy = 0;
- it = focusProxyReverseMap.erase(it);
- }
+ item->d_ptr->resetFocusProxy();
// Remove from parent, or unregister from toplevels.
if (QGraphicsItem *parentItem = item->parentItem()) {