mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
a mutex added to TempMods which hopefully fixes rare segfaults on client
This commit is contained in:
parent
71948dbf96
commit
03d67af9e8
4 changed files with 82 additions and 76 deletions
|
@ -399,15 +399,30 @@ public:
|
|||
<<", mod.type="<<mod.type
|
||||
<<", mod.param="<<mod.param
|
||||
<<std::endl;*/
|
||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
||||
m_temp_mods[p] = mod;
|
||||
}
|
||||
// Returns true if there was one
|
||||
bool getTempMod(v3s16 p, struct NodeMod *mod)
|
||||
{
|
||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
||||
core::map<v3s16, NodeMod>::Node *n;
|
||||
n = m_temp_mods.find(p);
|
||||
if(n == NULL)
|
||||
return false;
|
||||
if(mod)
|
||||
*mod = n->getValue();
|
||||
return true;
|
||||
}
|
||||
void clearTempMod(v3s16 p)
|
||||
{
|
||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
||||
if(m_temp_mods.find(p))
|
||||
m_temp_mods.remove(p);
|
||||
}
|
||||
void clearTempMods()
|
||||
{
|
||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
||||
m_temp_mods.clear();
|
||||
}
|
||||
#endif
|
||||
|
@ -517,6 +532,7 @@ private:
|
|||
// Temporary modifications to nodes
|
||||
// These are only used when drawing
|
||||
core::map<v3s16, NodeMod> m_temp_mods;
|
||||
JMutex m_temp_mods_mutex;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue