diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-08-23 11:08:50 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-08-23 10:45:13 +0000 |
commit | b6c298d82293f2de3525cbbc6c26f94466bda034 (patch) | |
tree | d1eb645c1e56f1c66c270f01450fa19082fd72ba /src/qml/qml/qqmltypeloader.cpp | |
parent | 941d820d7fe09ee9c1eeb10ddbba28eb45fd559f (diff) |
Fix memory corruption with type trimming
When creating a composite type, we register the meta-type in the qml
loader thread. However we would require linking of the compilation unit
to the QML/engine thread before we would be able to also undo that
registration in unlink(), because we require the engine member to be
set. If that did not happen, i.e. a qml type was loaded and trimmed from
the cache before it was ever linked, we would end up with a dangling
pointer in m_compositeTypes.
Let's handle the case of CompilationUnit referring to a QML composite
type separately from it being a compilation unit resulting from a .js
file or in a plain QJSEngine environment.
Task-number: QTBUG-62630
Change-Id: Ia68cc46f05345702bd9ba0378f61118f1964d141
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index efa4ed2f79..84410875ab 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2295,7 +2295,7 @@ void QQmlTypeData::done() } } - m_compiledData->finalize(enginePrivate); + m_compiledData->finalizeCompositeType(enginePrivate); } { |