summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-05-06 06:16:08 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-05-06 06:16:08 (GMT)
commitbf965a3b74a10636a63f72d72ad41e169a9851e3 (patch)
treebdc89890964200f2f119e3c92177d924939aa180 /src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
parent385799a8269dfb5b48de9e84e52af780fb400272 (diff)
downloadQt-bf965a3b74a10636a63f72d72ad41e169a9851e3.zip
Qt-bf965a3b74a10636a63f72d72ad41e169a9851e3.tar.gz
Qt-bf965a3b74a10636a63f72d72ad41e169a9851e3.tar.bz2
Avoid warnings as delegates with bindings to parent are created and destroyed.
Task-number: QTBUG-10359
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index f01d4c2..c6a6b81 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -44,6 +44,7 @@
#include "qdeclarativeitem.h"
#include <qdeclarativecontext.h>
+#include <qdeclarativecontext_p.h>
#include <qdeclarativeengine.h>
#include <qdeclarativeexpression.h>
#include <qdeclarativepackage_p.h>
@@ -963,6 +964,13 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q
}
if (d->m_cache.releaseItem(obj)) {
+ // Remove any bindings to avoid warnings due to parent change.
+ QObjectPrivate *p = QObjectPrivate::get(obj);
+ Q_ASSERT(p->declarativeData);
+ QDeclarativeData *d = static_cast<QDeclarativeData*>(p->declarativeData);
+ if (d->ownContext && d->context)
+ d->context->clearExpressions();
+
if (inPackage) {
emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj));
} else {