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.
This commit is contained in:
xinef1
2017-02-04 22:37:16 +01:00
committed by Shauren
parent 9e1b286984
commit 86da1a19bb
20 changed files with 175 additions and 126 deletions

View File

@@ -216,7 +216,7 @@ void ObjectGridStoper::Visit(CreatureMapType &m)
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
iter->GetSource()->RemoveAllDynObjects();
if (iter->GetSource()->IsInCombat())
if (iter->GetSource()->IsInCombat() || !iter->GetSource()->getThreatManager().areThreatListsEmpty())
{
iter->GetSource()->CombatStop();
iter->GetSource()->DeleteThreatList();