aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcomponent.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-06-21 10:56:00 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-06-23 12:34:51 +0200
commit714d9d95484907378b46292df7aec0832f557f1d (patch)
treea2fa6446a723bcb79d68cfcb3d5dd715ccc9b084 /src/qml/qml/qqmlcomponent.cpp
parentfca40e7cf81338e4c22ef25fa0b3fe0f691632b7 (diff)
Fix memory leak in QQmlComponent::createObject
Regression introduced with 5.3.0. Prevent the leak of the object creator on repeated createObject calls by using a scoped pointer. Change-Id: Ib4fe7c9c6926c2390f7ae78f3287bb7da5f60527 Task-number: QTBUG-39742 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcomponent.cpp')
-rw-r--r--src/qml/qml/qqmlcomponent.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index e9a3449a22..1da2f1c109 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -880,7 +880,7 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context)
enginePriv->referenceScarceResources();
QObject *rv = 0;
- state.creator = new QQmlObjectCreator(context, cc, creationContext);
+ state.creator.reset(new QQmlObjectCreator(context, cc, creationContext));
rv = state.creator->create(start);
if (!rv)
state.errors = state.creator->errors;
@@ -920,7 +920,7 @@ void QQmlComponentPrivate::beginDeferred(QQmlEnginePrivate *enginePriv,
Q_ASSERT(ddata->deferredData);
QQmlData::DeferredData *deferredData = ddata->deferredData;
QQmlContextData *creationContext = 0;
- state->creator = new QQmlObjectCreator(deferredData->context->parent, deferredData->compiledData, creationContext);
+ state->creator.reset(new QQmlObjectCreator(deferredData->context->parent, deferredData->compiledData, creationContext));
if (!state->creator->populateDeferredProperties(object))
state->errors << state->creator->errors;
}