forked from qt-creator/qt-creator
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.
This commit is contained in:
@@ -2528,6 +2528,7 @@ const ObjectValue *Engine::qtObject() const
|
|||||||
|
|
||||||
void Engine::registerValue(Value *value)
|
void Engine::registerValue(Value *value)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&_mutex);
|
||||||
_registeredValues.append(value);
|
_registeredValues.append(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
|
#include <QtCore/QMutex>
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
@@ -735,6 +736,8 @@ private:
|
|||||||
TypeId _typeId;
|
TypeId _typeId;
|
||||||
|
|
||||||
CppQmlTypes _cppQmlTypes;
|
CppQmlTypes _cppQmlTypes;
|
||||||
|
|
||||||
|
QMutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user