diff --git a/include/dynamic-graph/pool.h b/include/dynamic-graph/pool.h index 14deae37ae094b0dd1ef47eb6c319384099784ab..a16844eb2c0e906e7765559cb7bd424bdff321c4 100644 --- a/include/dynamic-graph/pool.h +++ b/include/dynamic-graph/pool.h @@ -76,6 +76,10 @@ namespace dynamicgraph */ void deregisterEntity (const std::string& entname); + /*! \brief Unregister an entity. + \par[in] entity: iterator in the map, + */ + void deregisterEntity( const Entities::iterator& entity ); /*! \brief Get an entity. \par[in] entname: The name of the entity, \return Pointer towards the entity. diff --git a/src/dgraph/pool.cpp b/src/dgraph/pool.cpp index 3776a46e2e31420286ce3c42a9ab933266d70115..28eee63768b7c10c7a0df97e2eb6d411f76b77a0 100644 --- a/src/dgraph/pool.cpp +++ b/src/dgraph/pool.cpp @@ -48,11 +48,12 @@ PoolStorage:: { dgDEBUG(15) << "Delete \"" << (iter->first) <<"\""<<std::endl; - delete ((Entity*)iter->second); + Entity* entity = iter->second; + deregisterEntity(iter); + delete (entity); } dgDEBUGOUT(15); - return; }