Emit selection `RegionsChanged` when region is removed

This is required to properly update the selection.
Previously deleting a region did not update selection
markers and other selection displays that depend on
Editor::get_selection_extents (which includes region selection).

This fixes a crash: Select a region (this sets a time-selection).
Delete the region, click on the time-selection markers (red triangles).
This commit is contained in:
Robin Gareus 2023-09-10 15:23:53 +02:00
parent 1c8b91ed86
commit d37f85f9d2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 3 additions and 15 deletions

View File

@ -39,7 +39,6 @@ using namespace PBD;
*/
RegionSelection::RegionSelection ()
{
RegionView::RegionViewGoingAway.connect (death_connection, MISSING_INVALIDATOR, boost::bind (&RegionSelection::remove_it, this, _1), gui_context());
}
/** Copy constructor.
@ -48,8 +47,6 @@ RegionSelection::RegionSelection ()
RegionSelection::RegionSelection (const RegionSelection& other)
: std::list<RegionView*>()
{
RegionView::RegionViewGoingAway.connect (death_connection, MISSING_INVALIDATOR, boost::bind (&RegionSelection::remove_it, this, _1), gui_context());
for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
add (*i);
}
@ -132,15 +129,6 @@ RegionSelection::add (RegionView* rv)
return true;
}
/** Remove a region from the selection.
* @param rv Region to remove.
*/
void
RegionSelection::remove_it (RegionView *rv)
{
remove (rv);
}
/** Remove a region from the selection.
* @param rv Region to remove.
* @return true if the region was in the selection, false if not.

View File

@ -72,12 +72,9 @@ public:
ARDOUR::RegionList regionlist () const;
private:
void remove_it (RegionView*);
void add_to_layer (RegionView *);
std::list<RegionView *> _bylayer; ///< list of regions sorted by layer
PBD::ScopedConnection death_connection;
};
#endif /* __ardour_gtk_region_selection_h__ */

View File

@ -77,6 +77,9 @@ Selection::Selection (const PublicEditor* e, bool mls)
void (Selection::*point_remove)(ControlPoint*) = &Selection::remove;
ControlPoint::CatchDeletion.connect (*this, MISSING_INVALIDATOR, boost::bind (point_remove, this, _1), gui_context());
void (Selection::*rv_remove)(RegionView*) = &Selection::remove;
RegionView::RegionViewGoingAway.connect (*this, MISSING_INVALIDATOR, boost::bind (rv_remove, this, _1), gui_context());
}
#if 0