aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-17 19:02:38 -0500
committermegamage <none@none>2009-06-17 19:02:38 -0500
commitf5ad3bab6294e0e408b3d266d397e5853ff1862a (patch)
treef8aa1341881fd7da0f76fca527d67293a4496609 /src
parente84714fa9a8298687773003a84258b92152c865b (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.cpp18
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;