projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
94a5df7
)
Settings: Prevent mutex deadlock in remove() (#7803)
author
SmallJoker
<mk939@ymail.com>
Wed, 18 Sep 2019 16:48:23 +0000
(18:48 +0200)
committer
SmallJoker
<mk939@ymail.com>
Wed, 18 Sep 2019 16:48:41 +0000
(18:48 +0200)
src/settings.cpp
patch
|
blob
|
history
diff --git
a/src/settings.cpp
b/src/settings.cpp
index 876c63e7b2c1ea57019a35a6b57f91be73f9463b..c1fe41fa33f4bf26ca7b11cb2277121deccdbd32 100644
(file)
--- a/
src/settings.cpp
+++ b/
src/settings.cpp
@@
-908,17
+908,20
@@
bool Settings::setNoiseParams(const std::string &name,
bool Settings::remove(const std::string &name)
{
- MutexAutoLock lock(m_mutex);
+ // Lock as short as possible, unlock before doCallbacks()
+ m_mutex.lock();
SettingEntries::iterator it = m_settings.find(name);
if (it != m_settings.end()) {
delete it->second.group;
m_settings.erase(it);
+ m_mutex.unlock();
doCallbacks(name);
return true;
}
+ m_mutex.unlock();
return false;
}