mirror of https://github.com/odrling/Aegisub
Fix potential use-after-frees on redo
Don't delete the old copy of the file until after the new version is committed to avoid a use-after-free when code tries to do things with the active line in a COMMIT_NEW handler, as just trying to avoid doing that hasn't really worked out.
This commit is contained in:
parent
21b9fe1405
commit
20b4515c24
|
@ -323,9 +323,12 @@ void SubsController::Redo() {
|
|||
context->ass->swap(redo_stack.back().file);
|
||||
commit_id = redo_stack.back().commit_id;
|
||||
undo_stack.emplace_back(*context->ass, redo_stack.back().undo_description, commit_id);
|
||||
redo_stack.pop_back();
|
||||
|
||||
context->ass->Commit("", AssFile::COMMIT_NEW);
|
||||
|
||||
// Done after commit so that the old active line and selection stay alive
|
||||
// while the commit is being processed
|
||||
redo_stack.pop_back();
|
||||
}
|
||||
|
||||
wxString SubsController::GetUndoDescription() const {
|
||||
|
|
Loading…
Reference in New Issue