mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
Fix for possible race/crash condition in ItemInst::ClearByFlags()
This commit is contained in:
parent
4978999d78
commit
0eb7eefcb5
@ -1710,9 +1710,17 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
|
||||
end = m_contents.end();
|
||||
for (; cur != end;) {
|
||||
ItemInst* inst = cur->second;
|
||||
if (inst == nullptr)
|
||||
if (inst == nullptr) {
|
||||
cur = m_contents.erase(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
if (item == nullptr) {
|
||||
cur = m_contents.erase(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
del = cur;
|
||||
++cur;
|
||||
|
||||
@ -1723,6 +1731,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
|
||||
m_contents.erase(del->first);
|
||||
continue;
|
||||
}
|
||||
// no 'break;' deletes 'byFlagNotSet' type - can't add at the moment because it really *breaks* the process somewhere
|
||||
case byFlagNotSet:
|
||||
if (item->NoDrop != 0) {
|
||||
safe_delete(inst);
|
||||
@ -1740,6 +1749,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
|
||||
m_contents.erase(del->first);
|
||||
continue;
|
||||
}
|
||||
// no 'break;' deletes 'byFlagNotSet' type - can't add at the moment because it really *breaks* the process somewhere
|
||||
case byFlagNotSet:
|
||||
if (item->NoRent != 0) {
|
||||
safe_delete(inst);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user