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 1c833f28e471e3787f1d328e44af5f065ad9ca8c)
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