forked from teamnwah/openmw-tes3coop
Fix dangling static references in mShared
This commit is contained in:
parent
3961fb36d4
commit
9acd4061cc
1 changed files with 9 additions and 0 deletions
|
@ -187,6 +187,15 @@ namespace MWWorld
|
||||||
T item;
|
T item;
|
||||||
item.mId = Misc::StringUtils::lowerCase(id);
|
item.mId = Misc::StringUtils::lowerCase(id);
|
||||||
|
|
||||||
|
// delete from static part of shared
|
||||||
|
typename std::vector<T *>::iterator sharedit = mShared.begin();
|
||||||
|
for (; sharedit != (mShared.begin()+mStatic.size()); ++sharedit) {
|
||||||
|
if((*sharedit)->mId == item.mId) {
|
||||||
|
mShared.erase(sharedit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typename std::map<std::string, T>::iterator it = mStatic.find(item.mId);
|
typename std::map<std::string, T>::iterator it = mStatic.find(item.mId);
|
||||||
|
|
||||||
if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) {
|
if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) {
|
||||||
|
|
Loading…
Reference in a new issue