mirror of https://github.com/odrling/Aegisub
Fix crash when splitting lines by karaoke
Defer the deletion of the old lines until after the commit as is now done for everything that deletes selected lines.
This commit is contained in:
parent
8c6a3d85ba
commit
0ccac34cb0
|
@ -1052,7 +1052,7 @@ struct edit_line_split_by_karaoke final : public validate_sel_nonempty {
|
||||||
Selection new_sel;
|
Selection new_sel;
|
||||||
AssKaraoke kara;
|
AssKaraoke kara;
|
||||||
|
|
||||||
bool did_split = false;
|
std::vector<std::unique_ptr<AssDialogue>> to_delete;
|
||||||
for (auto line : sel) {
|
for (auto line : sel) {
|
||||||
kara.SetLine(line);
|
kara.SetLine(line);
|
||||||
|
|
||||||
|
@ -1071,11 +1071,11 @@ struct edit_line_split_by_karaoke final : public validate_sel_nonempty {
|
||||||
new_sel.insert(new_line);
|
new_sel.insert(new_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete line;
|
c->ass->Events.erase(c->ass->iterator_to(*line));
|
||||||
did_split = true;
|
to_delete.emplace_back(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!did_split) return;
|
if (to_delete.empty()) return;
|
||||||
|
|
||||||
c->ass->Commit(_("splitting"), AssFile::COMMIT_DIAG_ADDREM | AssFile::COMMIT_DIAG_FULL);
|
c->ass->Commit(_("splitting"), AssFile::COMMIT_DIAG_ADDREM | AssFile::COMMIT_DIAG_FULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue