From dd4243b62379d9a1d6e8a7f13b1f7c4fa3de2984 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 17 Jan 2011 14:18:39 +1000 Subject: Fix memory leak Introduced by 488e616b50707e5b37162e6d0cfc71a1ffdf9bef --- src/declarative/qml/qdeclarativebinding.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 223d057..2092087 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -247,9 +247,15 @@ QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeCont QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(qmlEngine(obj)); QDeclarativeCompiledData *cdata = 0; - if (engine && ctxtdata && !ctxtdata->url.isEmpty()) - cdata = engine->typeLoader.get(ctxtdata->url)->compiledData(); - return cdata ? new QDeclarativeBinding((void*)cdata->datas.at(id).constData(), cdata, obj, ctxtdata, url, lineNumber, parent) : 0; + QDeclarativeTypeData *typeData = 0; + if (engine && ctxtdata && !ctxtdata->url.isEmpty()) { + typeData = engine->typeLoader.get(ctxtdata->url); + cdata = typeData->compiledData(); + } + QDeclarativeBinding *rv = cdata ? new QDeclarativeBinding((void*)cdata->datas.at(id).constData(), cdata, obj, ctxtdata, url, lineNumber, parent) : 0; + if (typeData) + typeData->release(); + return rv; } QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContext *ctxt, -- cgit v0.12