Fix memory leak in live inputs

This commit is contained in:
Thulinma 2018-10-10 17:10:18 +02:00
parent 8afad6d574
commit 2aa86ccf01
3 changed files with 8 additions and 0 deletions

View file

@ -282,6 +282,7 @@ namespace DTSC {
Track();
Track(JSON::Value & trackRef);
Track(Scan & trackRef);
void clearParts();
inline operator bool() const {
return (parts.size() && keySizes.size() && (keySizes.size() == keys.size()));

View file

@ -1297,6 +1297,10 @@ namespace DTSC {
fragments.rbegin()->setSize(fragments.rbegin()->getSize() + packDataSize);
}
void Track::clearParts(){
while (fragments.size() > 1){removeFirstKey();}
}
/// Removes the first buffered key, including any fragments it was part of
void Track::removeFirstKey(){
HIGH_MSG("Erasing key %d:%lu", trackID, keys[0].getNumber());