From 163e00ad3e9506c20436af9fb951e4bc08d01129 Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Sun, 11 Apr 2021 14:37:50 -0700 Subject: [PATCH] :bug: AdminAddUser modified size_lock_flag out of scope of lock --- include/bank.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/bank.hpp b/include/bank.hpp index f56a905..1fa1a55 100644 --- a/include/bank.hpp +++ b/include/bank.hpp @@ -31,9 +31,7 @@ private: bool size_lock_flag = true; Json::Value temp; - -public: - std::string admin_pass; + z public : std::string admin_pass; bool AddUser(const std::string &name, std::string &&init_pass) { @@ -48,10 +46,9 @@ public: if (state) { std::unique_lock lock{size_lock}; - state = users.try_emplace_l( + size_lock_flag += state = users.try_emplace_l( name, [](User &) {}, init_bal, std::move(init_pass)); } - size_lock_flag += state; return state; }