Fix memory leak in AssLimitToVisibleFilter

Originally committed to SVN as r4576.
This commit is contained in:
Thomas Goyne 2010-06-24 01:24:15 +00:00
parent 2b47f34e76
commit cf9eef80ab

View file

@ -78,22 +78,18 @@ void AssLimitToVisibleFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog
// Nothing to do
if (frame == -1) return;
// Process
using std::list;
AssDialogue *diag;
entryIter cur, next = subs->Line.begin();
while (next != subs->Line.end()) {
// Set next
cur = next++;
// Is dialogue?
diag = dynamic_cast<AssDialogue*>(*cur);
if (diag) {
int f1 = VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true);
int f2 = VFR_Output.GetFrameAtTime(diag->End.GetMS(),false);
// Invisible, remove frame
if (f1 > frame || f2 < frame) {
if (VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true) > frame ||
VFR_Output.GetFrameAtTime(diag->End.GetMS(),false) < frame) {
delete *cur;
subs->Line.erase(cur);
}
}