mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-14 04:02:53 -04:00
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:
@@ -2601,7 +2601,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
|
||||
@@ -2818,7 +2819,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