should resolve segfaults

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13174 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hilnius
2013-07-11 00:25:39 +00:00
parent 7665f30828
commit f15a9b58c4
3 changed files with 9 additions and 3 deletions

View File

@@ -135,9 +135,9 @@ void NetworkManager::notifyEvent(Event* event)
Log::warn("NetworkManager", "The peer that has been disconnected was not registered by the Network Manager.");
Log::info("NetworkManager", "Somebody is now disconnected. There are now %lu peers.", m_peers.size());
delete event; // in this case only, the event has been copied by the protocol manager
}
delete event; // in this case only, the event has been copied by the protocol manager
}
//-----------------------------------------------------------------------------

View File

@@ -265,8 +265,12 @@ void ProtocolManager::update()
{
Log::debug("ProtocolManager", "Message is \"%s\"", event->data.c_str());
}
delete event->peer; // because we made a copy of the peer
delete event;
if (event->type == event->type == EVENT_TYPE_DISCONNECTED)
{ // because we made a copy of the event and the peer
delete event->peer;
delete event;
}
}
// now update all protocols

View File

@@ -43,6 +43,8 @@ STKPeer::~STKPeer()
{
m_peer = NULL;
}
if (m_player_profile)
m_player_profile = NULL;
}
bool STKPeer::connectToHost(STKHost* localhost, TransportAddress host, uint32_t channel_count, uint32_t data)