13
0

Handle exception from export formats with unknown enum values

Before, an export format with an invalid enum value (for example in the
Encoding id) would crash Ardour with:

	unhandled exception (type std::exception) in signal handler:
	what: unknown enumerator FOO in PBD::EnumWriter

That kind of error can happen if a new type is introduced and users
switch back to versions without it.

Instead, catch such exceptions while loading a format, log an error, and
skip the format - similar to how other format loading errors are
handled.
This commit is contained in:
Mads Kiilerich 2022-10-10 12:31:45 +02:00 committed by Robin Gareus
parent 44c037dc4f
commit 07c370bdc9

View File

@ -788,7 +788,13 @@ ExportProfileManager::load_format_from_disk (std::string const& path)
return;
}
ExportFormatSpecPtr format = handler->add_format (*root);
ExportFormatSpecPtr format;
try {
format = handler->add_format (*root);
} catch (PBD::unknown_enumeration& e) {
error << string_compose (_("Cannot export format read from %1: %2"), path, e.what()) << endmsg;
return;
}
if (format->format_id () == ExportFormatBase::F_FFMPEG) {
std::string unused;