TrinityCore
TrinityCore copied to clipboard
possible crash
///- 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
where the dump?
http://pastebin.com/hGVZCfxY
did you tried to post same at TrinityCore issue tracker? I'm not an expert in crash fixing
already done it before, but I do not want to hear
The cause is exactly what's described in the source you pasted. Maybe adding if (_player->IsInWorld()) ?
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
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); }
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
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
Kapoeira other ideas on this crash?
Did you tried to compile with
-DWITH_COREDEBUG=1
?
yes compile with -DWITH_COREDEBUG=1