Skip to content

Commit

Permalink
fix multithread access segmentation fault
Browse files Browse the repository at this point in the history
  • Loading branch information
cdkr authored and killerwife committed May 23, 2023
1 parent ca933d1 commit a6ef7a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/game/Maps/SpawnGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ void CreatureGroup::MoveHome()
void CreatureGroup::Despawn(uint32 timeMSToDespawn, bool onlyAlive, uint32 forcedDespawnTime)
{
time_t when = time(nullptr) + forcedDespawnTime;
for (auto objItr : m_objects)
auto objects = m_objects;

for (auto objItr : objects)
{
uint32 dbGuid = objItr.first;
if (Creature* creature = m_map.GetCreature(dbGuid))
Expand Down

2 comments on commit a6ef7a3

@Novivy
Copy link

@Novivy Novivy commented on a6ef7a3 May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@killerwife this needs to be done on void GameObjectGroup::Despawn too probably

@killerwife
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did do that tho.

Please sign in to comment.