Fix edge-cases when loading old (v2, v3) sessions

Previously when loading old session Route::init() of the master-bus
was called without the "MasterOut" or "MonitorOut" flag being set.

Various conditions that relied on is_master() or is_monitor()
during initialization failed when loading those sessions, leading
to subtle breakage.
This commit is contained in:
Robin Gareus
2020-08-10 19:12:32 +02:00
parent 8c2a460b7d
commit ac97e5710a
3 changed files with 14 additions and 3 deletions

View File

@@ -235,6 +235,7 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful
PresentationInfo& operator= (PresentationInfo const& other);
static Flag get_flags (XMLNode const& node);
static Flag get_flags2X3X (XMLNode const& node);
static std::string state_node_name;
/* for things concerned about *any* PresentationInfo.

View File

@@ -225,6 +225,17 @@ PresentationInfo::get_flags (XMLNode const& node)
return Flag (0);
}
PresentationInfo::Flag
PresentationInfo::get_flags2X3X (XMLNode const& node)
{
/* Ardour 2.x and session-format 300x used <Route flags="MasterOut" .. /> */
Flag f;
if (node->get_property (X_("flags"), f)) {
return f;
}
return get_flags (node);
}
void
PresentationInfo::set_color (PresentationInfo::color_t c)
{

View File

@@ -1908,7 +1908,6 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
PresentationInfo::Flag flags = PresentationInfo::get_flags (node);
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML"), flags));
if (r->init () == 0 && r->set_state (node, version) == 0) {
BOOST_MARK_ROUTE (r);
ret = r;
@@ -1956,7 +1955,7 @@ Session::XMLRouteFactory_3X (const XMLNode& node, int version)
ret = track;
} else {
PresentationInfo::Flag flags = PresentationInfo::get_flags (node);
PresentationInfo::Flag flags = PresentationInfo::get_flags2X3X (node);
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML"), flags));
if (r->init () == 0 && r->set_state (node, version) == 0) {
@@ -2027,7 +2026,7 @@ Session::XMLRouteFactory_2X (const XMLNode& node, int version)
ret = track;
} else {
PresentationInfo::Flag flags = PresentationInfo::get_flags (node);
PresentationInfo::Flag flags = PresentationInfo::get_flags2X3X (node);
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML"), flags));
if (r->init () == 0 && r->set_state (node, version) == 0) {