Fix huge memory link in Collection iterator.

* Bug: In Hurricane::Collection::iterator, the iterator use a locator from
    a getLocator() not wrapped inside an auto_pointer like GenericLocator.
    So the destructor of the iterator must take care of the deletion.
      This was showing more and more as we converted forEach() into the
    C++ 11 for syntax.
      Seems to decrease the memory use by almost a factor 2...
* Bug: In Dijkstra::_cleanup(), as a double security, cleanup the queue.
This commit is contained in:
Jean-Paul Chaput 2019-03-23 15:43:00 +01:00
parent 3a2916b5e6
commit 3e4430c089
2 changed files with 2 additions and 0 deletions

View File

@ -1779,6 +1779,7 @@ namespace Anabatic {
//_checkEdges();
_sources.clear();
_targets.clear();
_queue.clear();
_searchArea.makeEmpty();
_connectedsId = 0;
}

View File

@ -206,6 +206,7 @@ template<class Type> class Collection {
class iterator {
public:
iterator ( Locator<Type>* l ) : _locator(l) {}
~iterator () { delete _locator; }
bool operator== ( const iterator& o) const { return not (*this != o); }
iterator& operator++ () { _locator->progress(); return *this; }
Type operator* () { return _locator->getElement(); }