Ouch! We were deleting the same links twice

This commit is contained in:
Tiago Gomes 2013-03-18 12:56:36 +00:00
parent 07dba92406
commit 403695a7ba

View File

@ -30,21 +30,10 @@ BeliefProp::BeliefProp (const FactorGraph& fg)
BeliefProp::~BeliefProp() BeliefProp::~BeliefProp()
{ {
for (size_t i = 0; i < varsLinks_.size(); i++) {
BpLinks& links = varsLinks_[i];
for (unsigned j = 0; j < links.size(); j++) {
delete links[j];
}
}
for (size_t i = 0; i < facsLinks_.size(); i++) {
BpLinks& links = facsLinks_[i];
for (unsigned j = 0; j < links.size(); j++) {
delete links[j];
}
}
for (size_t i = 0; i < links_.size(); i++) { for (size_t i = 0; i < links_.size(); i++) {
delete links_[i]; delete links_[i];
} }
links_.clear();
} }