From a9b614fc188b06a149c7697d62c7cfbcbeb3ccce Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Tue, 4 Feb 2020 13:07:23 -0600 Subject: [PATCH] Fix a potential case where PresentationInfo type flag is not set (see comment for details) --- libs/ardour/route.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 14805a62c4..07cc39669a 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2617,6 +2617,26 @@ Route::set_state (const XMLNode& node, int version) Stripable::set_state (node, version); + /* "This should never happen" + Stripable's job is to save/recall the PresentationInfo flags for bus/track audio/midi VCA etc. + But I found a case where no "type" flag is set, so the strip never shows up on any UI. + Since I don't know the source of the error, I have to assume that it could happen again. + So: if a stripable doesn't have any flags set, populate them from our audio/midi track/bus identity. + */ + PresentationInfo::Flag file_flags = _presentation_info.flags(); + if ( !(file_flags & PresentationInfo::TypeMask) ) { + if (dynamic_cast(this)) { + _presentation_info.set_flags ( PresentationInfo::Flag (file_flags | PresentationInfo::AudioTrack) ); + } + else if (dynamic_cast(this)) { + _presentation_info.set_flags ( PresentationInfo::Flag (file_flags | PresentationInfo::MidiTrack) ); + } + else if (dynamic_cast(this)) { + //no idea what this is, so let's call it an audio bus + _presentation_info.set_flags ( PresentationInfo::Flag (file_flags | PresentationInfo::AudioBus) ); + } + } + node.get_property (X_("strict-io"), _strict_io); if (is_monitor()) {