From 6ada6c553bec3b43a6c92aaa364cd4da20f1315b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 20 May 2020 01:02:36 +0200 Subject: Speed up automation lane removal with many ctrl points Deleting the group first, directly removes child items without triggering Canvas::item_changed() for every item. This significantly speeds up closing sessions (or deleting tracks) with lots of automation events. --- gtk2_ardour/automation_line.cc | 9 +++++++-- gtk2_ardour/control_point.h | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 34d59ef581..802c29cf01 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -131,8 +131,13 @@ AutomationLine::AutomationLine (const string& name, AutomationLine::~AutomationLine () { - vector_delete (&control_points); - delete group; + delete group; // deletes child items + + for (std::vector::iterator i = control_points.begin(); i != control_points.end(); i++) { + (*i)->unset_item (); + delete *i; + } + control_points.clear (); if (_our_time_converter) { delete _time_converter; diff --git a/gtk2_ardour/control_point.h b/gtk2_ardour/control_point.h index 88b074f6f9..ed9c10e6d7 100644 --- a/gtk2_ardour/control_point.h +++ b/gtk2_ardour/control_point.h @@ -79,6 +79,9 @@ public: ArdourCanvas::Item& item() const; + /* used from ~AutomationLine */ + void unset_item () { _item = 0 ; } + ARDOUR::AutomationList::iterator model() const { return _model; } AutomationLine& line() const { return _line; } -- cgit v1.2.3