Fixing nasty bugs found with the help of cppcheck. This should be backported to the current server asap.

This commit is contained in:
lotodore
2011-02-08 16:41:46 +00:00
parent 55a5903142
commit c55c003f1f
2 changed files with 9 additions and 5 deletions
+6 -3
View File
@@ -1224,10 +1224,12 @@ ClientThread::RemoveDisconnectedPlayers()
// This should only be called between hands. // This should only be called between hands.
if (m_game) if (m_game)
{ {
PlayerListIterator it; PlayerList tmpList(m_game->getSeatsList());
for (it = m_game->getSeatsList()->begin(); it != m_game->getSeatsList()->end(); it++) PlayerListIterator i = tmpList->begin();
PlayerListIterator end = tmpList->end();
while (i != end)
{ {
boost::shared_ptr<PlayerInterface> tmpPlayer = *it; boost::shared_ptr<PlayerInterface> tmpPlayer = *i;
if (tmpPlayer->getMyActiveStatus()) if (tmpPlayer->getMyActiveStatus())
{ {
// If a player is not in the player data list, it was disconnected. // If a player is not in the player data list, it was disconnected.
@@ -1237,6 +1239,7 @@ ClientThread::RemoveDisconnectedPlayers()
tmpPlayer->setMyActiveStatus(false); tmpPlayer->setMyActiveStatus(false);
} }
} }
++i;
} }
} }
} }
+3 -2
View File
@@ -847,8 +847,9 @@ ServerGame::RemoveDisconnectedPlayers()
// This should only be called between hands. // This should only be called between hands.
if (m_game) if (m_game)
{ {
PlayerListIterator i = m_game->getSeatsList()->begin(); PlayerList tmpList(m_game->getSeatsList());
PlayerListIterator end = m_game->getSeatsList()->end(); PlayerListIterator i = tmpList->begin();
PlayerListIterator end = tmpList->end();
while (i != end) while (i != end)
{ {
boost::shared_ptr<PlayerInterface> tmpPlayer = *i; boost::shared_ptr<PlayerInterface> tmpPlayer = *i;