Changeset 11713


Ignore:
Timestamp:
07/30/11 16:04:48 (13 years ago)
Author:
tbretz
Message:
Fixed a problem in RemoveAllServers - it must be made sure that the reference given to RemoveServer is not deleted during usage.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/DimServiceInfoList.cc

    r11275 r11713  
    148148void DimServiceInfoList::RemoveAllServers()
    149149{
    150     for (ServiceInfoList::iterator i=fServiceInfoList.begin();
    151          i!=fServiceInfoList.end(); i++)
    152         RemoveServer(i->first);
     150    while (fServiceInfoList.size()>0)
     151    {
     152        // We need to make a copy, otherwise RemoveServer will
     153        // destroy the staring the reference is pointing to
     154        const string name = fServiceInfoList.begin()->first;
     155        RemoveServer(name);
     156    }
    153157}
    154158
     
    231235                    stringstream err;
    232236                    err << "Service '" << server << "/" << name << "' not in list as it ought to be.";
     237                    // Seems to happen why more than one client is subscribed
     238                    // and e.g. the datalogger is immediately quit
    233239                    throw runtime_error(err.str());
    234240                }
Note: See TracChangeset for help on using the changeset viewer.