From 7cbf7f370be29391d9f66ae58d65ac9cde92b0ea Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 13 Apr 2016 18:53:54 +0200 Subject: special case side-chain when copying plugin-state (fix crash, dup IO) --- gtk2_ardour/processor_box.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 03492d7c84..7685071d6f 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -1759,6 +1759,11 @@ ProcessorBox::object_drop (DnDVBox* source, ProcessorEntry* posi PBD::ID id = pi->id(); XMLNode& state = otherproc->get_state (); + /* strip side-chain state (processor inside processor must be a side-chain) + * otherwise we'll end up with duplicate ports-names. + * (this needs a better solution which retains connections) + */ + state.remove_nodes ("Processor"); proc->set_state (state, Stateful::loading_state_version); boost::dynamic_pointer_cast(proc)->update_id (id); return; @@ -3134,8 +3139,22 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr is a plugin. */ p.reset (new PluginInsert (*_session)); + /* we can't use RAII Stateful::ForceIDRegeneration + * because that'd void copying the state and wrongly bump + * the state-version counter. + * we need to load the state (incl external files) first and + * only then update the ID) + */ PBD::ID id = p->id(); - p->set_state (**niter, Stateful::current_state_version); + /* strip side-chain state (processor inside processor must be a side-chain) + * otherwise we'll end up with duplicate ports-names. + * (this needs a better solution which retains connections) + * We really would want Stateful::ForceIDRegeneration here :( + */ + XMLNode state (**niter); + state.remove_nodes ("Processor"); + + p->set_state (state, Stateful::current_state_version); boost::dynamic_pointer_cast(p)->update_id (id); } -- cgit v1.2.3