From 3723770807a40519ec0a3aec66ea94ed20c8849b Mon Sep 17 00:00:00 2001 From: dooglus Date: Thu, 11 Dec 2008 21:03:30 +0000 Subject: [PATCH] Fix 2412072: don't remove a node from the parent set of a linkable valuenode when replacing a link if the link is still in use by one of the sibling links. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2311 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/valuenode.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/synfig-core/trunk/src/synfig/valuenode.cpp b/synfig-core/trunk/src/synfig/valuenode.cpp index 5d8647a..7059cf9 100644 --- a/synfig-core/trunk/src/synfig/valuenode.cpp +++ b/synfig-core/trunk/src/synfig/valuenode.cpp @@ -269,8 +269,23 @@ LinkableValueNode::set_link(int i,ValueNode::Handle x) if(set_link_vfunc(i,x)) { + // Fix 2412072: remove the previous link from the parent_set unless one of the other links is also + // using it when we convert a value to 'switch', both 'on' and 'off' are linked to the same valuenode + // if we then disconnect one of the two, the one we disconnect is set to be a new valuenode_const + // and the previously shared value is removed from the parent set even though the other is still + // using it if(previous) - remove_child(previous.get()); + { + int size = link_count(), index; + for (index=0; index < size; ++index) + { + if (i == index) continue; + if (get_link(index) == previous) + break; + } + if (index == size) + remove_child(previous.get()); + } add_child(x.get()); if(!x->is_exported() && get_parent_canvas()) -- 2.7.4