From 3ce8f5599ecd922214d64fa2f0316f6b1223aac2 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 4 Jul 2018 16:44:44 +0200 Subject: [PATCH] Fix missing object locks --- lib/redis/rediswriter-utility.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/redis/rediswriter-utility.cpp b/lib/redis/rediswriter-utility.cpp index 6553da679..adbc4402a 100644 --- a/lib/redis/rediswriter-utility.cpp +++ b/lib/redis/rediswriter-utility.cpp @@ -127,18 +127,26 @@ static void CollectScalarVars(Value haystack, std::vector& path, std::map const Object::Ptr& obj = haystack.Get(); Dictionary::Ptr dict = dynamic_pointer_cast(obj); + if (dict) { + ObjectLock olock(dict); + for (auto& kv : dict) { path.emplace_back(kv.first); CollectScalarVars(kv.second, path, needles); path.pop_back(); } + break; } Array::Ptr arr = dynamic_pointer_cast(obj); + if (arr) { double index = 0.0; + + ObjectLock xlock(arr); + for (auto& v : arr) { path.emplace_back(index); CollectScalarVars(v, path, needles); @@ -146,6 +154,7 @@ static void CollectScalarVars(Value haystack, std::vector& path, std::map index += 1.0; } + break; } } @@ -227,6 +236,8 @@ Dictionary::Ptr RedisWriter::SerializeVars(const CustomVarObject::Ptr& object) auto env (GetEnvironment()); auto envChecksum (SHA1(env)); + ObjectLock olock(vars); + for (auto& kv : vars) { Dictionary::Ptr flatVars = new Dictionary();