- Fix a leak in HoltWidget
- Add a for_each_in() template in sequences.tcc git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1029 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
8e20f5499f
commit
93fefe49e0
|
@ -28,8 +28,10 @@
|
||||||
#include "backend/thread.hh"
|
#include "backend/thread.hh"
|
||||||
#include "holt_widget.hh"
|
#include "holt_widget.hh"
|
||||||
|
|
||||||
|
#include "deletor.tcc"
|
||||||
|
#include "sequences.tcc"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
@ -44,7 +46,6 @@ using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HoltNode::HoltNode(Vec2 pt)
|
HoltNode::HoltNode(Vec2 pt)
|
||||||
: _radius(20)
|
: _radius(20)
|
||||||
{
|
{
|
||||||
|
@ -520,12 +521,21 @@ void
|
||||||
HoltWidget::acquire()
|
HoltWidget::acquire()
|
||||||
{
|
{
|
||||||
std::cout << "HoltWidget::acquire" << endl;
|
std::cout << "HoltWidget::acquire" << endl;
|
||||||
|
|
||||||
|
const HoltResources& const_holt_resources = _holt_resources;
|
||||||
|
for(Iseq<HoltResources::const_iterator> it = iseq(const_holt_resources); it; ++it)
|
||||||
|
delete it->second;
|
||||||
_holt_resources.clear();
|
_holt_resources.clear();
|
||||||
|
|
||||||
|
for_each_in(_holt_schedulables, memory::deletor<HoltSchedulable>());
|
||||||
_holt_schedulables.clear();
|
_holt_schedulables.clear();
|
||||||
|
|
||||||
|
for_each_in(_holt_requests, memory::deletor<HoltRequest>());
|
||||||
_holt_requests.clear();
|
_holt_requests.clear();
|
||||||
|
|
||||||
_n_res = _n_proc = 0;
|
_n_res = _n_proc = 0;
|
||||||
|
|
||||||
const History& hist = _simulation->get_history();
|
const History& hist = _simulation->get_history();
|
||||||
const Environment& env = hist.get_last_environment();
|
const Environment& env = hist.get_last_environment();
|
||||||
|
|
||||||
Vec2 pos(2*_radius, 2*_radius);
|
Vec2 pos(2*_radius, 2*_radius);
|
||||||
|
|
|
@ -95,3 +95,17 @@ riseq(Container& c)
|
||||||
{
|
{
|
||||||
return Iseq<typename Container::reverse_iterator>(c.rbegin(), c.rend());
|
return Iseq<typename Container::reverse_iterator>(c.rbegin(), c.rend());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Container, class Functor>
|
||||||
|
Functor
|
||||||
|
for_each_in(const Container& c, Functor functor)
|
||||||
|
{
|
||||||
|
Iseq<typename Container::const_iterator> seq = iseq(c);
|
||||||
|
while(seq)
|
||||||
|
{
|
||||||
|
functor(*seq);
|
||||||
|
++seq;
|
||||||
|
}
|
||||||
|
return functor;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue