Cleanup session (drop references) when session-load fails

This commit is contained in:
Robin Gareus 2022-08-06 22:38:10 +02:00
parent 0c01c50023
commit 39513ac8ad
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 3 additions and 0 deletions

View File

@ -396,9 +396,11 @@ Session::Session (AudioEngine &eng,
if (!mix_template.empty()) {
try {
if (load_state (_current_snapshot_name, /* from_template = */ true)) {
destroy ();
throw SessionException (_("Failed to load template/snapshot state"));
}
} catch (PBD::unknown_enumeration& e) {
destroy ();
throw SessionException (_("Failed to parse template/snapshot state"));
}
@ -419,6 +421,7 @@ Session::Session (AudioEngine &eng,
} else {
if (load_state (_current_snapshot_name)) {
destroy ();
throw SessionException (_("Failed to load state"));
}
}