- Fix deletion using an ad-hoc functor to avoid memory leaks, instead that ptr_fun(operator delete). Valgrind says we're doing well with History\!
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@787 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
69a7ee03eb
commit
19ee5c1884
8 changed files with 62 additions and 8 deletions
|
@ -35,6 +35,7 @@
|
|||
#include "history_observer.hh"
|
||||
#include "concrete_history.hh"
|
||||
|
||||
#include "deletor.tcc"
|
||||
#include "smartp.tcc"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -44,6 +45,7 @@
|
|||
using namespace sgpem;
|
||||
using namespace std;
|
||||
using memory::smart_ptr;
|
||||
using memory::deletor;
|
||||
|
||||
|
||||
// ---------------
|
||||
|
@ -88,7 +90,8 @@ ConcreteHistory::ConcreteHistory()
|
|||
|
||||
ConcreteHistory::~ConcreteHistory()
|
||||
{
|
||||
for_each(_snapshots.begin(), _snapshots.end(), ptr_fun(operator delete));
|
||||
for_each(_snapshots.begin(), _snapshots.end(),
|
||||
deletor<ConcreteEnvironment>());
|
||||
}
|
||||
|
||||
ConcreteHistory::ConcreteHistory(const ConcreteHistory& h) :
|
||||
|
@ -391,7 +394,7 @@ ConcreteHistory::reset(bool notify)
|
|||
Snapshots::iterator it = _snapshots.begin();
|
||||
it++; // Skip first environment that we saved
|
||||
|
||||
for_each(it, _snapshots.end(), ptr_fun(operator delete));
|
||||
for_each(it, _snapshots.end(), deletor<ConcreteEnvironment>());
|
||||
_snapshots.resize(1); // Truncate to keep only our "model"
|
||||
|
||||
if(notify)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue