Ask LuaProc to drop references
This fixes a circular shared_ptr<> reference that prevents plugin destruction. LuaProc may hold references to Route that contains the plugin or the PluginInsert of the LuaPlugin. These are only dropped when the interpreter collects garbage. Previously this happened in the d'tor or LuaProc, but while the Plugin has a reference to the Insert, the Insert is not deleted and the d'tor is never called.
This commit is contained in:
parent
c2618903ae
commit
6742a0961c
|
@ -78,6 +78,8 @@ public:
|
|||
|
||||
PluginOutputConfiguration possible_output () const { return _output_configs; }
|
||||
|
||||
void drop_references ();
|
||||
|
||||
std::set<Evoral::Parameter> automatable() const;
|
||||
|
||||
void activate () { }
|
||||
|
|
|
@ -106,6 +106,8 @@ public:
|
|||
activate ();
|
||||
}
|
||||
|
||||
virtual void drop_references () {}
|
||||
|
||||
virtual std::set<Evoral::Parameter> automatable () const = 0;
|
||||
virtual std::string describe_parameter (Evoral::Parameter) = 0;
|
||||
virtual std::string state_node_name () const = 0;
|
||||
|
|
|
@ -61,6 +61,8 @@ public:
|
|||
PluginInsert (Session&, boost::shared_ptr<Plugin> = boost::shared_ptr<Plugin>());
|
||||
~PluginInsert ();
|
||||
|
||||
void drop_references ();
|
||||
|
||||
static const std::string port_automation_node_name;
|
||||
|
||||
int set_state(const XMLNode&, int version);
|
||||
|
|
|
@ -130,7 +130,7 @@ LuaProc::~LuaProc () {
|
|||
_stats_max[1] * (float)_stats_cnt / _stats_avg[1]);
|
||||
}
|
||||
#endif
|
||||
lua.do_command ("collectgarbage();");
|
||||
lua.collect_garbage ();
|
||||
delete (_lua_dsp);
|
||||
delete (_lua_latency);
|
||||
delete [] _control_data;
|
||||
|
@ -182,6 +182,12 @@ LuaProc::init ()
|
|||
lua.do_command ("function ardour () end");
|
||||
}
|
||||
|
||||
void
|
||||
LuaProc::drop_references ()
|
||||
{
|
||||
lua.collect_garbage ();
|
||||
}
|
||||
|
||||
boost::weak_ptr<Route>
|
||||
LuaProc::route () const
|
||||
{
|
||||
|
|
|
@ -110,6 +110,15 @@ PluginInsert::~PluginInsert ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
PluginInsert::drop_references ()
|
||||
{
|
||||
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
|
||||
(*i)->drop_references ();
|
||||
}
|
||||
Processor::drop_references ();
|
||||
}
|
||||
|
||||
void
|
||||
PluginInsert::set_strict_io (bool b)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user