TrinityCore icon indicating copy to clipboard operation
TrinityCore copied to clipboard

possible crash

Open pipposo opened this issue 13 years ago • 12 comments

    ///- 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
    _player->CleanupsBeforeDelete();
    sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() ,_player->GetGUIDLow());
    Map *_map = _player->GetMap();
    _map->Remove(_player, true);
    SetPlayer(NULL);                                    // deleted in Remove call

tobmaps how can I use to not have crash

in worldsession.cpp

pipposo avatar Apr 27 '11 16:04 pipposo

where the dump?

tobmaps avatar Apr 27 '11 16:04 tobmaps

http://pastebin.com/hGVZCfxY

pipposo avatar Apr 27 '11 16:04 pipposo

did you tried to post same at TrinityCore issue tracker? I'm not an expert in crash fixing

tobmaps avatar Apr 27 '11 17:04 tobmaps

already done it before, but I do not want to hear

pipposo avatar Apr 27 '11 17:04 pipposo

The cause is exactly what's described in the source you pasted. Maybe adding if (_player->IsInWorld()) ?

Warpten avatar Apr 29 '11 21:04 Warpten

Maybe adding if (_player->IsInWorld()) ? yes and crash

if (_player->IsInWorld())
_player->CleanupsBeforeDelete();
sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() ,_player->GetGUIDLow());
Map *_map = _player->GetMap();
_map->Remove(_player, true);
SetPlayer(NULL);                                    // deleted in Remove call

pipposo avatar Apr 30 '11 19:04 pipposo

No no ....

if (_player && _player->IsInWorld())
{
    _player->CleanupsBeforeDelete();
    sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() ,_player->GetGUIDLow());
    Map *_map = _player->GetMap();
    _map->Remove(_player, true);
    SetPlayer(NULL);
}

Warpten avatar Apr 30 '11 21:04 Warpten

sure it will cause a memory leak... Better to check it just for GetMap - then this memory leak will be not so big... I think better to contain map* somewhere to just get previous value in case player not in world

tobmaps avatar Apr 30 '11 22:04 tobmaps

try, but crash

if (_player && _player->IsInWorld()) { _player->CleanupsBeforeDelete(); sLog->outChar("Account: %d (IP: %s) Logout Character:[%s](GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() ,_player->GetGUIDLow()); Map *_map = _player->GetMap(); _map->Remove(_player, true); SetPlayer(NULL); }

http://pastebin.com/qpjdVKhb

pipposo avatar May 01 '11 10:05 pipposo

Kapoeira other ideas on this crash?

pipposo avatar May 05 '11 16:05 pipposo

Did you tried to compile with

-DWITH_COREDEBUG=1

?

tobmaps avatar May 05 '11 16:05 tobmaps

yes compile with -DWITH_COREDEBUG=1

pipposo avatar May 05 '11 17:05 pipposo