summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativebinding.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-01-17 04:18:39 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2011-01-17 04:31:37 (GMT)
commitdd4243b62379d9a1d6e8a7f13b1f7c4fa3de2984 (patch)
tree5b8b5728edb2fc39b14ebe84547084128c5f0801 /src/declarative/qml/qdeclarativebinding.cpp
parent8b6674e55118896dfecbcdc1960418dc2064f632 (diff)
downloadQt-dd4243b62379d9a1d6e8a7f13b1f7c4fa3de2984.zip
Qt-dd4243b62379d9a1d6e8a7f13b1f7c4fa3de2984.tar.gz
Qt-dd4243b62379d9a1d6e8a7f13b1f7c4fa3de2984.tar.bz2
Fix memory leak
Introduced by 488e616b50707e5b37162e6d0cfc71a1ffdf9bef
Diffstat (limited to 'src/declarative/qml/qdeclarativebinding.cpp')
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp12
1 files 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,