Skip to content

Commit

Permalink
[Fix] Properly destroy slices that were reduced
Browse files Browse the repository at this point in the history
  • Loading branch information
saif-el committed Jan 7, 2021
1 parent 8379209 commit 7255283
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/core/libmaven/massslicer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,15 @@ void MassSlicer::_reduceSlices(MassCutoff* massCutoff)
}

// remove merged slices
slices.erase(remove_if(slices.begin(),
slices.end(),
[](mzSlice* slice) {
return (slice->ionCount == -1.0f);
}),
slices.end());
vector<size_t> indexesToErase;
for (size_t i = 0; i < slices.size(); ++i) {
auto slice = slices[i];
if (slice->ionCount == -1.0f) {
delete slice;
indexesToErase.push_back(i);
}
}
mzUtils::eraseIndexes(slices, indexesToErase);
}

void MassSlicer::_mergeSlices(const MassCutoff* massCutoff,
Expand Down

0 comments on commit 7255283

Please sign in to comment.