summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qmlgraphicsloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qmlgraphicsloader.cpp')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsloader.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qmlgraphicsloader.cpp
index bb1020c..7cd4d1a 100644
--- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsloader.cpp
@@ -64,8 +64,14 @@ void QmlGraphicsLoaderPrivate::clear()
}
source = QUrl();
- delete item;
- item = 0;
+ if (item) {
+ // We can't delete immediately because our item may have triggered
+ // the Loader to load a different item.
+ item->setVisible(false);
+ static_cast<QGraphicsItem*>(item)->setParentItem(0);
+ item->deleteLater();
+ item = 0;
+ }
}
void QmlGraphicsLoaderPrivate::initResize()