mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
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.
This commit is contained in:
parent
16be88cdb6
commit
75e0f5a023
6 changed files with 25 additions and 2 deletions
|
|
@ -285,6 +285,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
|
|||
|
||||
AutomationTimeAxisView::~AutomationTimeAxisView ()
|
||||
{
|
||||
cleanup_gui_properties ();
|
||||
delete _view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue