Fix various crashes when a client exits.
This commit is contained in:
parent
8d843a7317
commit
09a32c2132
@ -398,6 +398,8 @@ void ServerLobbyRoomProtocol::kartDisconnected(Event* event)
|
||||
sendMessage(msg);
|
||||
Log::info("ServerLobbyRoomProtocol", "Player disconnected : id %d",
|
||||
peer->getPlayerProfile()->getPlayerID());
|
||||
// Remove the profile from the peer (to avoid double free)
|
||||
peer->setPlayerProfile(NULL);
|
||||
m_setup->removePlayer(peer->getPlayerProfile());
|
||||
STKHost::get()->removePeer(peer);
|
||||
}
|
||||
|
@ -233,6 +233,7 @@ void STKHost::init()
|
||||
*/
|
||||
STKHost::~STKHost()
|
||||
{
|
||||
ProtocolManager::kill();
|
||||
// delete the game setup
|
||||
if (m_game_setup)
|
||||
delete m_game_setup;
|
||||
@ -247,7 +248,6 @@ STKHost::~STKHost()
|
||||
|
||||
Network::closeLog();
|
||||
stopListening();
|
||||
ProtocolManager::kill();
|
||||
|
||||
delete m_network;
|
||||
} // ~STKHost
|
||||
@ -295,11 +295,10 @@ void STKHost::deleteAllPeers()
|
||||
*/
|
||||
void STKHost::abort()
|
||||
{
|
||||
stopListening();
|
||||
// FIXME: Why a reset here? This creates a new stk_host, which will open
|
||||
// a new packet_log file (and therefore delete the previous file)???
|
||||
// reset();
|
||||
// Finish protocol manager first, to avoid that it access data
|
||||
// in STKHost.
|
||||
ProtocolManager::getInstance()->abort();
|
||||
stopListening();
|
||||
} // abort
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user