mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Prevent crash at access to deleted social data for player.
Remove social data at logout instead ~Player that called also for temporary Player object for Player::MinimalLoadFromDB call.
This commit is contained in:
parent
9e6390d88d
commit
74ddd38af3
3 changed files with 4 additions and 5 deletions
|
|
@ -426,10 +426,8 @@ Player::~Player ()
|
||||||
{
|
{
|
||||||
CleanupsBeforeDelete();
|
CleanupsBeforeDelete();
|
||||||
|
|
||||||
if(m_uint32Values) // only for fully created Object
|
// it must be unloaded already in PlayerLogout and accessed only for loggined player
|
||||||
{
|
//m_social = NULL;
|
||||||
sSocialMgr.RemovePlayerSocial(GetGUIDLow());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: buy back item already deleted from DB when player was saved
|
// Note: buy back item already deleted from DB when player was saved
|
||||||
for(int i = 0; i < PLAYER_SLOTS_COUNT; ++i)
|
for(int i = 0; i < PLAYER_SLOTS_COUNT; ++i)
|
||||||
|
|
|
||||||
|
|
@ -4945,7 +4945,7 @@ void Spell::EffectDuel(uint32 i)
|
||||||
Player *target = (Player*)unitTarget;
|
Player *target = (Player*)unitTarget;
|
||||||
|
|
||||||
// caster or target already have requested duel
|
// caster or target already have requested duel
|
||||||
if( caster->duel || target->duel || target->GetSocial()->HasIgnore(caster->GetGUIDLow()) )
|
if( caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities)
|
// Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities)
|
||||||
|
|
|
||||||
|
|
@ -380,6 +380,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
///- Delete the player object
|
///- Delete the player object
|
||||||
_player->CleanupsBeforeDelete(); // do some cleanup before deleting to prevent crash at crossreferences to already deleted data
|
_player->CleanupsBeforeDelete(); // do some cleanup before deleting to prevent crash at crossreferences to already deleted data
|
||||||
|
|
||||||
|
sSocialMgr.RemovePlayerSocial (_player->GetGUIDLow ());
|
||||||
delete _player;
|
delete _player;
|
||||||
_player = NULL;
|
_player = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue