diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-25 15:58:36 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-25 17:31:56 +0100 |
commit | 70c37506e9e7c7228ca823cff0f75a5813f3bcb7 (patch) | |
tree | b547f5a410328fadcf7121519e24dcf87e80c225 /src/qml/qml/qqmlcompiler_p.h | |
parent | 26350b5ceafa0ade1328037f6234a7d288eb8f48 (diff) |
Fix memory corruption in QML expression compilation
We store QQmlPropertyData pointers in our IR for Qt meta-object property
resolution at compile time. As it turns out however, it is possible that these
pointers change after retrieval from the QQmlPropertyCache, as the cache may
change later in the compilation process. Therefore we must do what also
QQmlCompiler does by storing a copy of the QQmlPropertyData. For the JS IR we
can do that conveniently through the IR memory pool.
A side-effect of this bug was that QQmlPropertyData pointers were re-used
and so the identity check in the isel later such as
_function->contextObjectDependencies.contains(m->property)
for dependency tracking failed. In the example given in the bug report it was
determined that the window.contentWidth property wouldn't need a property
capture, and therefore the binding was not re-evaluated as window.contentWidth
later in the binding evaluation phase received its correct value.
This patch also fixes the incorrect debug output names assigned to JS binding
expressions, where the index used to look up the name is per compiled object,
not per QML component.
Task-number: QTBUG-35063
Change-Id: I3e5bbfaac11e5c122a2ed15a3e486a93988e1b6e
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcompiler_p.h')
-rw-r--r-- | src/qml/qml/qqmlcompiler_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h index 2e3e6b8f4c..3ca4566e41 100644 --- a/src/qml/qml/qqmlcompiler_p.h +++ b/src/qml/qml/qqmlcompiler_p.h @@ -315,6 +315,7 @@ namespace QQmlCompilerTypes { QList<QQmlJS::AST::Node*> functionsToCompile; QVector<int> runtimeFunctionIndices; QVector<CompiledMetaMethod> compiledMetaMethods; + QHash<int, QString> expressionNames; }; QHash<QQmlScript::Object *, PerObjectCompileData> jsCompileData; }; |