From bfd7fd464e94fa7fe55be9ac8fd3f1c5f8968cf7 Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Fri, 24 Sep 2010 13:54:28 +0200 Subject: [PATCH] QmlJS: Synchronize Engine::registerValue. When multiple threads share the Bind instance in a Document and do lookup on the objects contained inside, that may trigger a new object creation in some situations - which needs to be synchronized. --- src/libs/qmljs/qmljsinterpreter.cpp | 1 + src/libs/qmljs/qmljsinterpreter.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index ff32bb517bf..e23deedbbe0 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -2528,6 +2528,7 @@ const ObjectValue *Engine::qtObject() const void Engine::registerValue(Value *value) { + QMutexLocker locker(&_mutex); _registeredValues.append(value); } diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index f6c7086fb18..771aa729428 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -40,6 +40,7 @@ #include <QtCore/QString> #include <QtCore/QHash> #include <QtCore/QSet> +#include <QtCore/QMutex> namespace QmlJS { @@ -735,6 +736,8 @@ private: TypeId _typeId; CppQmlTypes _cppQmlTypes; + + QMutex _mutex; }; -- GitLab