diff options
author | Martin Jones <martin.jones@nokia.com> | 2012-03-20 11:58:09 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-20 05:37:59 +0100 |
commit | 0ecadd9530626e981fa994cee1d505d32249f503 (patch) | |
tree | 29d0da268c354e0c47f406c92e9b4b2cd5bb74f6 /src/quick/items | |
parent | 01f09669e2b6bc1f43160d787fabc6ca9e4b3c12 (diff) |
Loader could leak qml contexts if interrupted
If Loader was either destroyed, or its source changed while
it was incubating the itemContext could be leaked.
Change-Id: I5b749062552954d92bf2851250f942b20ebbfe68
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickloader.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 59cb37c15d..f41ba44943 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -61,6 +61,8 @@ QQuickLoaderPrivate::QQuickLoaderPrivate() QQuickLoaderPrivate::~QQuickLoaderPrivate() { + delete itemContext; + itemContext = 0; delete incubator; disposeInitialPropertyValues(); } @@ -79,12 +81,21 @@ void QQuickLoaderPrivate::itemGeometryChanged(QQuickItem *resizeItem, const QRec void QQuickLoaderPrivate::clear() { + Q_Q(QQuickLoader); disposeInitialPropertyValues(); if (incubator) incubator->clear(); + delete itemContext; + itemContext = 0; + if (loadingFromSource && component) { + // disconnect since we deleteLater + QObject::disconnect(component, SIGNAL(statusChanged(QQmlComponent::Status)), + q, SLOT(_q_sourceLoaded())); + QObject::disconnect(component, SIGNAL(progressChanged(qreal)), + q, SIGNAL(progressChanged())); component->deleteLater(); component = 0; } @@ -545,6 +556,7 @@ void QQuickLoaderPrivate::setInitialState(QObject *obj) QQml_setParent_noEvent(itemContext, obj); QQml_setParent_noEvent(item, q); item->setParentItem(q); + itemContext = 0; } if (initialPropertyValues.IsEmpty()) |