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