mirror of https://github.com/odrling/Aegisub
Keep the old subtitles file alive until the new one is fully announced
This fixes crashes from touching dangling references to lines in the old subtitle file in the handlers for the various signals triggered when a new file is opened.
This commit is contained in:
parent
ca1cf8d9e7
commit
47b8627ad3
|
@ -173,6 +173,8 @@ void SubsController::SetSelectionController(SelectionController *selection_contr
|
|||
}
|
||||
|
||||
void SubsController::Load(agi::fs::path const& filename, std::string charset) {
|
||||
AssFile temp;
|
||||
|
||||
try {
|
||||
try {
|
||||
if (charset.empty())
|
||||
|
@ -198,10 +200,7 @@ void SubsController::Load(agi::fs::path const& filename, std::string charset) {
|
|||
}
|
||||
}
|
||||
|
||||
const SubtitleFormat *reader = SubtitleFormat::GetReader(filename, charset);
|
||||
|
||||
AssFile temp;
|
||||
reader->ReadFile(&temp, filename, context->videoController->FPS(), charset);
|
||||
SubtitleFormat::GetReader(filename, charset)->ReadFile(&temp, filename, context->videoController->FPS(), charset);
|
||||
|
||||
// Make sure the file has at least one style and one dialogue line
|
||||
if (temp.Styles.empty())
|
||||
|
|
Loading…
Reference in New Issue