Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8301 in orxonox.OLD for branches/network


Ignore:
Timestamp:
Jun 9, 2006, 7:12:08 PM (19 years ago)
Author:
rennerc
Message:

fixed master memory leak :D

Location:
branches/network/src/lib/network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/connection_monitor.h

    r8068 r8301  
    1414#define N_PACKETS_FOR_PING 20
    1515#define MSECS_TO_CALC_BWIDTH 1000
    16 #define SECS_TO_TIMEOUT 10
     16#define SECS_TO_TIMEOUT 30
    1717
    1818class ConnectionMonitor : virtual public BaseObject
  • branches/network/src/lib/network/network_game_manager.cc

    r8273 r8301  
    7171{
    7272  delete MessageManager::getInstance();
     73 
     74  PlayerStats::deleteAllPlayerStats();
    7375}
    7476
  • branches/network/src/lib/network/player_stats.cc

    r8245 r8301  
    228228
    229229
     230
     231void PlayerStats::deleteAllPlayerStats( )
     232{
     233  const std::list<BaseObject*> * list;
     234 
     235  while ( (list  = ClassList::getList( CL_PLAYER_STATS )) != NULL && list->begin() != list->end() )
     236    delete *list->begin();
     237}
     238
  • branches/network/src/lib/network/player_stats.h

    r8245 r8301  
    6060    static bool changeNickHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
    6161    void shellNick( const std::string&  newNick );
     62   
     63    static void deleteAllPlayerStats();
    6264
    6365  private:
  • branches/network/src/lib/network/synchronizeable.cc

    r8273 r8301  
    8383    for ( StateHistory::iterator it2 = it->begin(); it2 != it->end(); it2++ )
    8484    {
    85       delete [] (*it2)->data;
     85      if ( (*it2)->data )
     86      {
     87        delete [] (*it2)->data;
     88        (*it2)->data = NULL;
     89      }
    8690      delete *it2;
    8791    }
     
    9397    for ( StateHistory::iterator it2 = it->begin(); it2 != it->end(); it2++ )
    9498    {
    95       delete [] (*it2)->data;
     99      if ( (*it2)->data )
     100      {
     101        delete [] (*it2)->data;
     102        (*it2)->data = NULL;
     103      }
    96104      delete *it2;
    97105    }
     
    160168        (*it2)->data = NULL;
    161169      }
     170     
     171      delete *it2;
    162172    }
    163173    sentStates[userId].erase( sentStates[userId].begin(), it );
     
    191201    stateFrom = (*it);
    192202
    193   StateHistoryEntry * stateTo = new StateHistoryEntry();
    194 
     203  StateHistoryEntry * stateTo = new StateHistoryEntry;
     204
     205  sentStates[userId].push_back( stateTo );
     206 
    195207  stateTo->stateId = stateId;
    196208  stateTo->dataLength = neededSize;
     
    241253  }
    242254
    243   sentStates[userId].push_back( stateTo );
    244  
    245255  if ( i != neededSize )
    246256  {
     
    407417    {
    408418      if ( (*it)->data )
     419      {
    409420        delete [] (*it)->data;
    410       (*it)->data = NULL;
     421        (*it)->data = NULL;
     422      }
    411423   
    412424      delete *it;
     
    421433    {
    422434      if ( (*it)->data )
     435      {
    423436        delete [] (*it)->data;
    424       (*it)->data = NULL;
     437        (*it)->data = NULL;
     438      }
    425439   
    426440      delete *it;
     
    471485     
    472486      if ( (*delIt)->data )
     487      {
    473488        delete [] (*delIt)->data;
     489        (*delIt)->data = NULL;
     490      }
    474491      delete *delIt;
    475492      recvStates[userId].erase( delIt );
     
    540557     
    541558      if ( (*delIt)->data )
     559      {
    542560        delete [] (*delIt)->data;
     561        (*delIt)->data = NULL;
     562      }
    543563      delete *delIt;
    544564      sentStates[userId].erase( delIt );
Note: See TracChangeset for help on using the changeset viewer.