From 795671d6852c03105392620db340705778aa9a0f Mon Sep 17 00:00:00 2001 From: William Katz Date: Fri, 2 Apr 2021 22:59:41 -1000 Subject: [PATCH] :bug: del user funcs didn't grab save lock --- include/bank.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/bank.hpp b/include/bank.hpp index ea68b09..a00f8f2 100644 --- a/include/bank.hpp +++ b/include/bank.hpp @@ -41,10 +41,12 @@ public: bool DelUser(const std::string &name, const std::string &attempt) { + std::shared_lock lock{save_lock}; return users.erase_if(name, [&attempt](const User &u) { return (attempt == u.password); }); } bool AdminDelUser(const std::string &name, const std::string &attempt) { + std::shared_lock lock{save_lock}; return users.erase_if(name, [this, &attempt](const User &) { return (admin_pass == attempt); }); }