13
0

[Summary] For tracks when saving templates, we need stored the Auto Loop Range and all MIDI markers. As well, just to follow canonical rule: dealing with a pointer (_location in Session::state) check it for NULL prior to any operation (s), accessing the pointer.

[Review required] YPozdnyakov, GZharun, Paul Davis
This commit is contained in:
Valeriy Kamyshniy 2015-04-03 00:25:56 +03:00 committed by Paul Davis
parent 2a1d0e20f0
commit 7c5d849247

View File

@ -1046,16 +1046,30 @@ Session::state (bool full_state)
} }
} }
if (full_state) { if (full_state) {
node->add_child_nocopy (_locations->get_state());
if (_locations) {
node->add_child_nocopy (_locations->get_state());
}
} else { } else {
Locations loc (*this);
// for a template, just create a new Locations, populate it // for a template, just create a new Locations, populate it
// with the default start and end, and get the state for that. // with the default start and end, and get the state for that.
Locations loc (*this);
Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange); Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange);
range->set (max_framepos, 0); range->set (max_framepos, 0);
loc.add (range); loc.add (range);
node->add_child_nocopy (loc.get_state()); XMLNode& locations_state = loc.get_state();
if (ARDOUR::Profile->get_trx() && _locations) {
for (Locations::LocationList::const_iterator i = _locations->list ().begin (); i != _locations->list ().end (); ++i) {
if ((*i)->is_mark () || (*i)->is_auto_loop ()) {
locations_state.add_child_nocopy ((*i)->get_state ());
}
}
}
node->add_child_nocopy (locations_state);
} }
child = node->add_child ("Bundles"); child = node->add_child ("Bundles");
@ -1077,11 +1091,11 @@ Session::state (bool full_state)
RouteList public_order (*r); RouteList public_order (*r);
public_order.sort (cmp); public_order.sort (cmp);
/* the sort should have put control outs first */ /* the sort should have put control outs first */
if (_monitor_out) { if (_monitor_out) {
assert (_monitor_out == public_order.front()); assert (_monitor_out == public_order.front());
} }
for (RouteList::iterator i = public_order.begin(); i != public_order.end(); ++i) { for (RouteList::iterator i = public_order.begin(); i != public_order.end(); ++i) {
if (!(*i)->is_auditioner()) { if (!(*i)->is_auditioner()) {