1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-23 21:29:13 +02:00

Added workaround to prevent multithreaded access to bonus system in RMG

This commit is contained in:
Ivan Savenko 2024-01-23 00:49:18 +02:00
parent ea439ad175
commit f83a004b54

View File

@ -273,6 +273,10 @@ CBonusSystemNode::~CBonusSystemNode()
void CBonusSystemNode::attachTo(CBonusSystemNode & parent)
{
// quick workaround to prevent multithreaded access to bonus system in RMG
static boost::mutex attachMutex;
boost::lock_guard<boost::mutex> lock(attachMutex);
assert(!vstd::contains(parents, &parent));
parents.push_back(&parent);
@ -646,4 +650,4 @@ int64_t CBonusSystemNode::getTreeVersion() const
return treeChanged;
}
VCMI_LIB_NAMESPACE_END
VCMI_LIB_NAMESPACE_END