mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 08:32:13 +11:00
🐛 AdminAddUser modified size_lock_flag out of scope of lock
This commit is contained in:
parent
2fabf8d8db
commit
163e00ad3e
1 changed files with 2 additions and 5 deletions
|
|
@ -31,9 +31,7 @@ private:
|
||||||
|
|
||||||
bool size_lock_flag = true;
|
bool size_lock_flag = true;
|
||||||
Json::Value temp;
|
Json::Value temp;
|
||||||
|
z public : std::string admin_pass;
|
||||||
public:
|
|
||||||
std::string admin_pass;
|
|
||||||
|
|
||||||
bool AddUser(const std::string &name, std::string &&init_pass)
|
bool AddUser(const std::string &name, std::string &&init_pass)
|
||||||
{
|
{
|
||||||
|
|
@ -48,10 +46,9 @@ public:
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::shared_mutex> lock{size_lock};
|
std::unique_lock<std::shared_mutex> lock{size_lock};
|
||||||
state = users.try_emplace_l(
|
size_lock_flag += state = users.try_emplace_l(
|
||||||
name, [](User &) {}, init_bal, std::move(init_pass));
|
name, [](User &) {}, init_bal, std::move(init_pass));
|
||||||
}
|
}
|
||||||
size_lock_flag += state;
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue