From ae3590023b3489bc72c0af2a3c8da5dfebd7a4a1 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 16 Apr 2019 17:38:58 +0200 Subject: [PATCH] Namespace: place ObjectLock in all methods (cherry picked from commit 5afda779435c848cf5a8411f713adc9891aa5092) --- lib/base/namespace.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/base/namespace.cpp b/lib/base/namespace.cpp index 8ca785318..91373fb26 100644 --- a/lib/base/namespace.cpp +++ b/lib/base/namespace.cpp @@ -37,6 +37,8 @@ Namespace::Namespace(NamespaceBehavior *behavior) Value Namespace::Get(const String& field) const { + ObjectLock olock(this); + Value value; if (!GetOwnField(field, &value)) BOOST_THROW_EXCEPTION(ScriptError("Namespace does not contain field '" + field + "'")); @@ -45,6 +47,8 @@ Value Namespace::Get(const String& field) const bool Namespace::Get(const String& field, Value *value) const { + ObjectLock olock(this); + auto nsVal = GetAttribute(field); if (!nsVal) @@ -56,16 +60,22 @@ bool Namespace::Get(const String& field, Value *value) const void Namespace::Set(const String& field, const Value& value, bool overrideFrozen) { + ObjectLock olock(this); + return SetFieldByName(field, value, overrideFrozen, DebugInfo()); } bool Namespace::Contains(const String& field) const { + ObjectLock olock(this); + return HasOwnField(field); } void Namespace::Remove(const String& field, bool overrideFrozen) { + ObjectLock olock(this); + m_Behavior->Remove(this, field, overrideFrozen); } @@ -103,6 +113,8 @@ void Namespace::SetAttribute(const String& key, const std::shared_ptr