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:
1 parent
a76da51e7f
commit
2c05a59815
20 files changed
+175
-126
No files matched your search
@@ -2609,7 +2609,8 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
||||
{
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
||||
if (Player* member = groupRef->GetSource())
|
||||
l->push_back(member);
|
||||
if (member->IsInMap(player))
|
||||
l->push_back(member);
|
||||
}
|
||||
// We still add the player to the list if there is no group. If we do
|
||||
// this even if there is a group (thus the else-check), it will add the
|
||||
@@ -2826,7 +2827,8 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
||||
{
|
||||
for (GroupReference* it = lootGroup->GetFirstMember(); it != nullptr; it = it->next())
|
||||
if (Player* recipient = it->GetSource())
|
||||
l->push_back(recipient);
|
||||
if (recipient->IsInMap(me))
|
||||
l->push_back(recipient);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user