diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-06-29 00:43:42 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-06-29 00:43:42 (GMT) |
commit | 189d2660968368532761586ffd495eb6c18cdbdf (patch) | |
tree | 36edb9c9da0c366cb8b00015f3cc52929575111a /src/declarative/graphicsitems/qdeclarativeloader.cpp | |
parent | 5b0de255d1facfe89efed393447a1c914ffdf414 (diff) | |
download | Qt-189d2660968368532761586ffd495eb6c18cdbdf.zip Qt-189d2660968368532761586ffd495eb6c18cdbdf.tar.gz Qt-189d2660968368532761586ffd495eb6c18cdbdf.tar.bz2 |
Ensure Loader item change listener is removed when Loader is destroyed
Task-number: QTBUG-11771
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeloader.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeloader.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 25b1119..c8c9e44 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -174,7 +174,7 @@ void QDeclarativeLoaderPrivate::initResize() QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeLoaderPrivate), parent) { - Q_D(QDeclarativeItem); + Q_D(QDeclarativeLoader); d->flags |= QGraphicsItem::ItemIsFocusScope; } @@ -183,6 +183,14 @@ QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent) */ QDeclarativeLoader::~QDeclarativeLoader() { + Q_D(QDeclarativeLoader); + if (d->item) { + if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(d->item)) { + QDeclarativeItemPrivate *p = + static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem)); + p->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); + } + } } /*! |