fix assumption that during dragging, a DraggingView's time_axis_view field is always a positive integer within range

This commit is contained in:
Paul Davis 2021-05-04 11:55:23 -06:00
parent 5bfc507cb3
commit 0aef128207
1 changed files with 17 additions and 5 deletions

View File

@ -1465,7 +1465,17 @@ RegionMoveDrag::finished (GdkEvent* ev, bool movement_occurred)
}
bool const changed_position = (_last_position.sample != _primary->region()->position());
bool const changed_tracks = (_time_axis_views[_views.front().time_axis_view] != &_views.front().view->get_time_axis_view());
bool changed_tracks;
if (_views.front().time_axis_view < 0) {
if (&_views.front().view->get_time_axis_view()) {
changed_tracks = true;
} else {
changed_tracks = false;
}
} else {
changed_tracks = (_time_axis_views[_views.front().time_axis_view] != &_views.front().view->get_time_axis_view());
}
if (_copy) {
@ -6602,10 +6612,12 @@ DraggingView::DraggingView (RegionView* v, RegionDrag* parent, TimeAxisView* ita
: view (v)
, initial_time_axis_view (itav)
{
/* note that time_axis_view may be null if the regionview was created
* as part of a copy operation.
*/
time_axis_view = parent->find_time_axis_view (&v->get_time_axis_view ());
TimeAxisView* tav = &v->get_time_axis_view();
if (tav) {
time_axis_view = parent->find_time_axis_view (&v->get_time_axis_view ());
} else {
time_axis_view = -1;
}
layer = v->region()->layer ();
initial_y = v->get_canvas_group()->position().y;
initial_playlist = v->region()->playlist ();