Ignore:
Timestamp:
07/31/11 12:02:11 (13 years ago)
Author:
tbretz
Message:
When removing something from a list we have to pass a copy instead of a reference otherwise the removal might remove the source of the reference.
File:
1 edited

Legend:

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

    r11713 r11730  
    113113//!
    114114//! @param s
    115 //!     server which should be removed
     115//!     server which should be removed. We need to make a copy, otherwise
     116//!     RemoveServer will destroy the staring the reference is pointing to
    116117//!
    117118//! @throws
    118119//!     a runtime_error is the server to be removed is not in the list
    119120//
    120 void DimServiceInfoList::RemoveServer(const string &s)
     121void DimServiceInfoList::RemoveServer(const string s)
    121122{
    122123    const ServiceInfoList::iterator v = fServiceInfoList.find(s);
     
    149150{
    150151    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     }
     152        RemoveServer(fServiceInfoList.begin()->first);
    157153}
    158154
Note: See TracChangeset for help on using the changeset viewer.