summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-03-30 15:27:18 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-03-30 15:27:23 -0400
commit75e0f5a023b5485a6f6efb3ebd6f2ae21f5a041b (patch)
tree1f8c91929737d61ba785b463076f9b92427655ff /gtk2_ardour
parent16be88cdb6bdf1db167de6d3488e3599e6d9eeb1 (diff)
remove GUI object state when tracks/busses are removed.
Not doing this results in accumulation of useless GUI object state which is never cleaned up. Taken from work by Grygorii Zharun.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/automation_time_axis.cc1
-rw-r--r--gtk2_ardour/axis_view.h6
-rw-r--r--gtk2_ardour/gui_object.cc10
-rw-r--r--gtk2_ardour/gui_object.h4
-rw-r--r--gtk2_ardour/route_time_axis.cc2
-rw-r--r--gtk2_ardour/route_ui.cc4
6 files changed, 25 insertions, 2 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 12876c1abb..b486d54840 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -285,6 +285,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
AutomationTimeAxisView::~AutomationTimeAxisView ()
{
+ cleanup_gui_properties ();
delete _view;
}
diff --git a/gtk2_ardour/axis_view.h b/gtk2_ardour/axis_view.h
index 7334945c2c..94f7708d90 100644
--- a/gtk2_ardour/axis_view.h
+++ b/gtk2_ardour/axis_view.h
@@ -70,6 +70,12 @@ class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, pu
property_hashtable.emplace(property_name, s.str());
gui_object_state().set_property<T> (state_id(), property_name, value);
}
+
+ void cleanup_gui_properties () {
+ /* remove related property node from the GUI state */
+ gui_object_state().remove_node (state_id());
+ property_hashtable.clear ();
+ }
bool marked_for_display () const;
virtual bool set_marked_for_display (bool);
diff --git a/gtk2_ardour/gui_object.cc b/gtk2_ardour/gui_object.cc
index 3e21f82fa4..b00cd5ae54 100644
--- a/gtk2_ardour/gui_object.cc
+++ b/gtk2_ardour/gui_object.cc
@@ -71,6 +71,16 @@ GUIObjectState::get_or_add_node (const string& id)
return get_or_add_node (&_state, id);
}
+/** Remove node with provided id.
+ * @param id property of Object node to look for.
+ */
+
+void
+GUIObjectState::remove_node (const std::string& id)
+{
+ _state.remove_nodes_and_delete(X_("id"), id );
+}
+
/** Get a string from our state.
* @param id property of Object node to look for.
* @param prop_name name of the Object property to return.
diff --git a/gtk2_ardour/gui_object.h b/gtk2_ardour/gui_object.h
index ee6d1cdf4c..aff025b2d5 100644
--- a/gtk2_ardour/gui_object.h
+++ b/gtk2_ardour/gui_object.h
@@ -47,12 +47,14 @@ public:
s << val;
child->add_property (prop_name.c_str(), s.str());
}
-
+
std::list<std::string> all_ids () const;
static XMLNode* get_node (const XMLNode *, const std::string &);
XMLNode* get_or_add_node (const std::string &);
static XMLNode* get_or_add_node (XMLNode *, const std::string &);
+
+ void remove_node (const std::string& id);
private:
XMLNode _state;
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 502e24d8a0..7d0883775d 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -323,6 +323,8 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
RouteTimeAxisView::~RouteTimeAxisView ()
{
+ cleanup_gui_properties ();
+
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
delete *i;
}
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 118306c29c..f038ead366 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -87,9 +87,11 @@ RouteUI::RouteUI (ARDOUR::Session* sess)
RouteUI::~RouteUI()
{
+ gui_object_state().remove_node(route_state_id());
+
_route.reset (); /* drop reference to route, so that it can be cleaned up */
route_connections.drop_connections ();
-
+
delete solo_menu;
delete mute_menu;
delete sends_menu;