diff options
author | megamage <none@none> | 2009-06-17 19:02:38 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-06-17 19:02:38 -0500 |
commit | f5ad3bab6294e0e408b3d266d397e5853ff1862a (patch) | |
tree | f8aa1341881fd7da0f76fca527d67293a4496609 /src | |
parent | e84714fa9a8298687773003a84258b92152c865b (diff) |
*First do cleanup then removefromworld for player. This fixes some crashes.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/WorldSession.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 9ffbc8e1b4d..44bab655886 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -372,25 +372,25 @@ void WorldSession::LogoutPlayer(bool Save) if(_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket) _player->RemoveFromGroup(); - ///- Remove the player from the world - // the player may not be in the world when logging out - // e.g if he got disconnected during a transfer to another map - // calls to GetMap in this case may cause crashes - if(_player->IsInWorld()) _player->GetMap()->Remove(_player, false); - // RemoveFromWorld does cleanup that requires the player to be in the accessor - ObjectAccessor::Instance().RemoveObject(_player); - ///- Send update to group if(_player->GetGroup()) _player->GetGroup()->SendUpdate(); ///- Broadcast a logout message to the player's friends sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true); + sSocialMgr.RemovePlayerSocial (_player->GetGUIDLow ()); ///- Delete the player object _player->CleanupsBeforeDelete(); // do some cleanup before deleting to prevent crash at crossreferences to already deleted data - sSocialMgr.RemovePlayerSocial (_player->GetGUIDLow ()); + ///- Remove the player from the world + // the player may not be in the world when logging out + // e.g if he got disconnected during a transfer to another map + // calls to GetMap in this case may cause crashes + if(_player->IsInWorld()) _player->GetMap()->Remove(_player, false); + // RemoveFromWorld does cleanup that requires the player to be in the accessor + ObjectAccessor::Instance().RemoveObject(_player); + delete _player; _player = NULL; |