From 8fcbe789b4b4a94d2ca6f5ef233b55a10e1cbe09 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 22 Mar 2021 04:07:53 +0100 Subject: [PATCH] Ignore pinout when copy/pasting plugins using Ctrl+c/v This can lead to invalid configuration and crashes in case plugin-replication changes. see also 9ab84a95f1e --- gtk2_ardour/processor_box.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index cd07d6d3c2..cb01a9d969 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -2047,6 +2047,8 @@ ProcessorBox::object_drop (DnDVBox* source, ProcessorEntry* posi /* 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) + * + * see also ProcessorBox::paste_processor_state */ state.remove_nodes_and_delete ("Processor"); state.remove_property ("count"); @@ -3590,14 +3592,30 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr * only then update the ID) */ PBD::ID id = p->id(); + XMLNode state (**niter); /* 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) + * + * see also ProcessorBox::object_drop */ - XMLNode state (**niter); state.remove_nodes_and_delete ("Processor"); + + uint32_t count = 0; + state.get_property ("count", count); state.remove_property ("count"); + state.remove_property ("custom"); + state.remove_nodes_and_delete ("ConfiguredInput"); + state.remove_nodes_and_delete ("CustomSinks"); + state.remove_nodes_and_delete ("ConfiguredOutput"); + state.remove_nodes_and_delete ("PresetOutput"); + state.remove_nodes_and_delete ("ThruMap"); + for (uint32_t i = 0; i < count; ++i) { + state.remove_nodes_and_delete (string_compose ("InputMap-%1", i)); + state.remove_nodes_and_delete (string_compose ("OutputMap-%1", i)); + } + /* Controllable and automation IDs should not be copied */ PBD::Stateful::ForceIDRegeneration force_ids; p->set_state (state, Stateful::current_state_version);