mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 10:56:38 +01:00
Core/Maps: Fix crash caused by setActive(false) called after DespawnOrUnsummon()
Fix crash caused by WorldObject::setActive(false) called after WorldObject::DespawnOrUnsummon() happening because the WorldObject would be set as not active but then Map::RemoveFromActiveHelper() would not be called because of not being in world anymore.
Whenever setActive() gets desync'd with what Map actually contains a rare crash would happen since Map only reads a few values of the active WorldObject, making it hard to reproduce. If this happens again some ASSERT calls should be added (or a check in Map::RemoveFromMap() could be added about if the WorldObject is in Map::m_activeNonPlayers container).
(cherry picked from commit 1c833f28e4)
This commit is contained in:
@@ -828,7 +828,7 @@ void WorldObject::setActive(bool on)
|
||||
|
||||
m_isActive = on;
|
||||
|
||||
if (!IsInWorld())
|
||||
if (on && !IsInWorld())
|
||||
return;
|
||||
|
||||
Map* map = FindMap();
|
||||
|
||||
Reference in New Issue
Block a user