Fix crash when deleting selected region-view in ripple mode #7764
authorRobin Gareus <robin@gareus.org>
Mon, 27 May 2019 12:10:59 +0000 (14:10 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 27 May 2019 12:10:59 +0000 (14:10 +0200)
Changing the playlist (remove_region) invalidates selection and
unsets `clicked_regionview`. The region to operate on needs
to be stored for later use.

gtk2_ardour/editor_ops.cc

index 306bf4f90602697cb24670afbd08e836cc0d889b..1c9df29d3d7aa5e4818b0a9244dc4bffc4bcb9c4 100644 (file)
@@ -4456,12 +4456,15 @@ Editor::remove_clicked_region ()
        begin_reversible_command (_("remove region"));
 
        boost::shared_ptr<Playlist> playlist = clicked_routeview->playlist();
+       boost::shared_ptr<Region> region = clicked_regionview->region();
 
        playlist->clear_changes ();
        playlist->clear_owned_changes ();
-       playlist->remove_region (clicked_regionview->region());
-       if (Config->get_edit_mode() == Ripple)
-               playlist->ripple (clicked_regionview->region()->position(), -clicked_regionview->region()->length(), boost::shared_ptr<Region>());
+       playlist->remove_region (region);
+
+       if (Config->get_edit_mode() == Ripple) {
+               playlist->ripple (region->position(), - region->length(), boost::shared_ptr<Region>());
+       }
 
        /* We might have removed regions, which alters other regions' layering_index,
           so we need to do a recursive diff here.