Commit 4b465dc6 authored by Mikaël Salson's avatar Mikaël Salson

core/germline.cpp: Index should be deleted if needed

See #3031
parent 6433a358
......@@ -240,7 +240,10 @@ MultiGermline::MultiGermline(IndexTypes indexType, bool _one_index_per_germline)
}
MultiGermline::~MultiGermline() {
for (list<Germline*>::const_iterator it = germlines.begin(); it != germlines.end(); ++it)
if (index && --(index->refs) == 0) {
delete index;
}
for (list<Germline*>::iterator it = germlines.begin(); it != germlines.end(); ++it)
{
delete *it ;
}
......@@ -373,6 +376,7 @@ void MultiGermline::build_with_one_index(string seed, bool set_index)
{
bool rc = true ;
index = KmerStoreFactory<KmerAffect>::createIndex(indexType, seed, rc);
index->refs = 1;
insert_in_one_index(index, set_index);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment