mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-06 23:26:26 +02:00
Added workaround to prevent multithreaded access to bonus system in RMG
This commit is contained in:
parent
ea439ad175
commit
f83a004b54
@ -273,6 +273,10 @@ CBonusSystemNode::~CBonusSystemNode()
|
|||||||
|
|
||||||
void CBonusSystemNode::attachTo(CBonusSystemNode & parent)
|
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));
|
assert(!vstd::contains(parents, &parent));
|
||||||
parents.push_back(&parent);
|
parents.push_back(&parent);
|
||||||
|
|
||||||
@ -646,4 +650,4 @@ int64_t CBonusSystemNode::getTreeVersion() const
|
|||||||
return treeChanged;
|
return treeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user