summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2009-09-22 13:19:03 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2009-09-22 13:19:03 (GMT)
commitdde7aa88765d2d14b72a80b0f7e046ea6be5f94e (patch)
tree218dc9fa6330fd4459e0445519d4373ba4664ad1 /src/declarative/qml
parentc00ba3cf914ddc842e06d00cfd0fe4b095a884c4 (diff)
downloadQt-dde7aa88765d2d14b72a80b0f7e046ea6be5f94e.zip
Qt-dde7aa88765d2d14b72a80b0f7e046ea6be5f94e.tar.gz
Qt-dde7aa88765d2d14b72a80b0f7e046ea6be5f94e.tar.bz2
Fix crash in ~QmlEngine when using QmlDom
QmlEngine keeps a pointer to QmlCompositeTypeData passed into QmlCompiler::compile. Therefore we have to also create QmlCompositeTypeData on the heap, and use reference counting.
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmldom.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index 9e12485..ce1bb93 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -151,7 +151,7 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl
d->errors.clear();
d->imports.clear();
- QmlCompiledData component;
+ QmlCompiledData *component = new QmlCompiledData;
QmlCompiler compiler;
QmlCompositeTypeData *td = ((QmlEnginePrivate *)QmlEnginePrivate::get(engine))->typeManager.getImmediate(data, url);
@@ -159,20 +159,23 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl
if(td->status == QmlCompositeTypeData::Error) {
d->errors = td->errors;
td->release();
+ component->release();
return false;
} else if(td->status == QmlCompositeTypeData::Waiting) {
QmlError error;
error.setDescription(QLatin1String("QmlDomDocument supports local types only"));
d->errors << error;
td->release();
+ component->release();
return false;
}
- compiler.compile(engine, td, &component);
+ compiler.compile(engine, td, component);
if (compiler.isError()) {
d->errors = compiler.errors();
td->release();
+ component->release();
return false;
}
@@ -196,6 +199,7 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl
d->root->addref();
}
+ component->release();
return true;
}