summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorJohannes Mueller <github@johannes-mueller.org>2020-04-05 18:55:09 +0200
committerJohannes Mueller <github@johannes-mueller.org>2020-04-05 19:07:28 +0200
commit3a2f0e40cfed091876a899afaa24582e60a8f024 (patch)
treed404d92630471cc1c0df0c0f7c806a76824e9094 /libs/ardour/session.cc
parent605b3d83a8c48c4ffb132ca74c69d9bdc95d1890 (diff)
Fix crash when adding tracks from a5 route templates
Ardour5 route templates seem not to have a in the root node playlist property. Ardour generally relies on that Track::playlist() always returns a valid playlist. Thus we need to create a playlist even if we don't have a playlist property in the route template's root node.
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 5510f738ce..a052727067 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -2893,6 +2893,14 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i
Stateful::ForceIDRegeneration force_ids;
IO::disable_connecting ();
+ /* New v6 templates do have a version in the Route-Template,
+ * we assume that all older, unversioned templates are
+ * from Ardour 5.x
+ * when Stateful::loading_state_version was 3002
+ */
+ int version = 3002;
+ node.get_property (X_("version"), version);
+
while (how_many) {
/* We're going to modify the node contents a bit so take a
@@ -2967,13 +2975,15 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i
} else { /* NewPlaylist */
PBD::ID pid;
+ std::string default_type;
+ node.get_property(X_("default-type"), default_type);
- if (node_copy.get_property (X_("audio-playlist"), pid)) {
+ if (node_copy.get_property (X_("audio-playlist"), pid) || (version < 5000 && default_type == "audio")) {
boost::shared_ptr<Playlist> playlist = PlaylistFactory::create (DataType::AUDIO, *this, name, false);
node_copy.set_property (X_("audio-playlist"), playlist->id());
}
- if (node_copy.get_property (X_("midi-playlist"), pid)) {
+ if (node_copy.get_property (X_("midi-playlist"), pid) || (version < 5000 && default_type == "midi")) {
boost::shared_ptr<Playlist> playlist = PlaylistFactory::create (DataType::MIDI, *this, name, false);
node_copy.set_property (X_("midi-playlist"), playlist->id());
}
@@ -3045,14 +3055,6 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i
*/
node_copy.remove_node_and_delete (X_("Controllable"), X_("name"), X_("solo"));
- /* New v6 templates do have a version in the Route-Template,
- * we assume that all older, unversioned templates are
- * from Ardour 5.x
- * when Stateful::loading_state_version was 3002
- */
- int version = 3002;
- node.get_property (X_("version"), version);
-
boost::shared_ptr<Route> route;
if (version < 3000) {