diff options
author | Alan Alpert <416365416c@gmail.com> | 2012-12-16 17:35:12 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-08 17:18:41 +0100 |
commit | 6163ae74d505a3e9733795c6ce63386038f826d1 (patch) | |
tree | 7b550eb299ef46d18e112e4921f48ee42f99f6e2 /src/qml/qml/qqmlvme.cpp | |
parent | 6576728b885cb89be715db9f9e2038527a14a455 (diff) |
Move VME exception to a better place
If o is not created, then ddata on the next line may also not create
successfuly leading to an invalid memory access before we reach the !o
exception.
Change-Id: I9b127dff7955456aacb25138fabaabaabaab921f
Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r-- | src/qml/qml/qqmlvme.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 9db3ee5a4d..00d8ad829f 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -558,6 +558,11 @@ QObject *QQmlVME::run(QList<QQmlError> *errors, QObject *o = 0; void *memory = 0; type.type->create(&o, &memory, sizeof(QQmlData)); + + if (!o) + VME_EXCEPTION(tr("Unable to create object of type %1").arg(type.type->elementName()), + instr.line); + QQmlData *ddata = new (memory) QQmlData; ddata->ownMemory = false; QObjectPrivate::get(o)->declarativeData = ddata; @@ -572,10 +577,6 @@ QObject *QQmlVME::run(QList<QQmlError> *errors, ddata->propertyCache->addref(); } - if (!o) - VME_EXCEPTION(tr("Unable to create object of type %1").arg(type.type->elementName()), - instr.line); - if (states.count() == 1) { // Keep a reference to the compiled data we rely on ddata->compiledData = states[0].compiledData; |