Fix the ability to set Session Start&End Range on a new, empty session

set_session_extents had a bug; it wasn't calling locations->add()
on the newly created location.

The correct implementation was in set_session_range_location,
but this was only called from one place.
This function was removed, and set_session_extents will be used in its place.
set_session_extents will create a session location if one no longer exists,
so there is no need for set_session_range_location.
This commit is contained in:
Ben Loftis 2020-01-25 11:27:31 -06:00 committed by Robin Gareus
parent db465b5b43
commit 2d07e72d40
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 8 additions and 17 deletions

View File

@ -2033,8 +2033,6 @@ private:
void rt_set_controls (boost::shared_ptr<ControlList>, double val, PBD::Controllable::GroupControlDisposition group_override);
void rt_clear_all_solo_state (boost::shared_ptr<RouteList>, bool yn, PBD::Controllable::GroupControlDisposition group_override);
void set_session_range_location (samplepos_t, samplepos_t);
void setup_midi_machine_control ();
void step_edit_status_change (bool);

View File

@ -1512,18 +1512,18 @@ Session::set_auto_punch_location (Location* location)
void
Session::set_session_extents (samplepos_t start, samplepos_t end)
{
Location* existing;
if ((existing = _locations->session_range_location()) == 0) {
//if there is no existing session, we need to make a new session location (should never happen)
existing = new Location (*this, 0, 0, _("session"), Location::IsSessionRange, 0);
}
if (end <= start) {
error << _("Session: you can't use that location for session start/end)") << endmsg;
return;
}
existing->set( start, end );
Location* existing;
if ((existing = _locations->session_range_location()) == 0) {
_session_range_location = new Location (*this, start, end, _("session"), Location::IsSessionRange, 0);
_locations->add (_session_range_location);
} else {
existing->set( start, end );
}
set_dirty();
}
@ -4176,7 +4176,7 @@ Session::maybe_update_session_range (samplepos_t a, samplepos_t b)
if (_session_range_location == 0) {
set_session_range_location (a, b + session_end_marker_shift_samples);
set_session_extents (a, b + session_end_marker_shift_samples);
} else {
@ -6111,13 +6111,6 @@ Session::current_end_sample () const
return _session_range_location ? _session_range_location->end() : 0;
}
void
Session::set_session_range_location (samplepos_t start, samplepos_t end)
{
_session_range_location = new Location (*this, start, end, _("session"), Location::IsSessionRange, 0);
_locations->add (_session_range_location);
}
void
Session::step_edit_status_change (bool yn)
{