Changeset 296839


Ignore:
Timestamp:
Apr 2, 2011, 12:21:41 AM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
1b1ba8
Parents:
bbd746
git-author:
Frederik Heber <heber@…> (04/01/11 12:34:08)
git-committer:
Frederik Heber <heber@…> (04/02/11 00:21:41)
Message:

BUGFIX: Registry<T>::cleanup() - first erase from list, then delete instance.

  • if we just delete all instances, then free the list. We ran into problems when instances had an unregisterInstance() call in their destructor for this effectively invalidated the current iterator.
  • Library version is now 7:2:0, API version is 1.1.2.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    rbbd746 r296839  
    33
    44AC_PREREQ([2.65])
    5 AC_INIT([CodePatterns], [1.1.1], [heber@ins.uni-bonn.de], [codepatterns], [http://trac.ins.uni-bonn.de/projects/CodePatterns/])
     5AC_INIT([CodePatterns], [1.1.2], [heber@ins.uni-bonn.de], [codepatterns], [http://trac.ins.uni-bonn.de/projects/CodePatterns/])
    66AC_CONFIG_AUX_DIR(config)
    77AC_CONFIG_SRCDIR([src/Patterns/Singleton_impl.hpp])
     
    2525# refer to the libtool manual, section "Updating library version information":
    2626# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
    27 AC_SUBST([CODEPATTERNS_SO_VERSION], [7:1:0])
    28 AC_SUBST([CODEPATTERNS_API_VERSION], [1.1.1])
     27AC_SUBST([CODEPATTERNS_SO_VERSION], [7:2:0])
     28AC_SUBST([CODEPATTERNS_API_VERSION], [1.1.2])
    2929
    3030# Checks for libraries.
  • src/Patterns/Registry_impl.hpp

    rbbd746 r296839  
    7878template <class T>void Registry<T>::cleanup()
    7979{
    80   typename std::map<const std::string,T*>::iterator iter;
    81   for(iter=InstanceMap.begin();iter!=InstanceMap.end();++iter) {
     80  typename std::map<const std::string,T*>::iterator iter = InstanceMap.begin();
     81  for(;!InstanceMap.empty();iter=InstanceMap.begin()) {
    8282    //std::cerr << "Removing instance "+iter->first+" from registry" << std::endl;
    83     delete iter->second;
     83    T* instance = iter->second;
     84    InstanceMap.erase(iter);
     85    delete instance;
    8486  }
    8587  InstanceMap.clear();
Note: See TracChangeset for help on using the changeset viewer.