Core/Misc: Fix various crashes, also related to multithreading (#19012)

* When iterating groups we have to either do it not in multithreaded context (map updates) or start with checking maps (they are guaranteed to change in single thread update).
* Properly clear ComboPoint references on player remove
* remove some possible references item may have when it is deleted during save.
* Also clear all hostile references when unit is removed from map.

(cherrypicked from 86da1a19bb)
This commit is contained in:
xinef1
2017-02-04 22:37:16 +01:00
committed by Shauren
parent 92e95ddf55
commit ad008c43b7
20 changed files with 173 additions and 124 deletions

View File

@@ -221,7 +221,7 @@ void ObjectGridStoper::Visit(CreatureMapType &m)
iter->GetSource()->RemoveAllDynObjects();
iter->GetSource()->RemoveAllAreaTriggers();
if (iter->GetSource()->IsInCombat())
if (iter->GetSource()->IsInCombat() || !iter->GetSource()->getThreatManager().areThreatListsEmpty())
{
iter->GetSource()->CombatStop();
iter->GetSource()->DeleteThreatList();