Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when SaveRespawnTimeImmediately config option is set to 0 #542

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,16 +909,18 @@ void Map::Remove(T* obj, bool remove)

m_objRemoveList.insert(obj->GetObjectGuid());

obj->ResetMap();
if (remove)
{
// if option set then object already saved at this moment
if (!sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY))
obj->SaveRespawnTime();

obj->ResetMap();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is unnecessary because obj is getting deleted right afterwards anyway, but maybe there was method to the madness, hence I kept it in both branches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I vote for removing this, since the destructor called by delete can invoke m_currMap->RemoveFromOnEventNotified(this);

// Note: In case resurrectable corpse and pet its removed from global lists in own destructor
delete obj;
}
else
obj->ResetMap();
}

void Map::PlayerRelocation(Player* player, float x, float y, float z, float orientation)
Expand Down