Fix 2353284: If two parameters in the same layer are connected to the same valuenode...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Thu, 27 Nov 2008 16:35:24 +0000 (16:35 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Thu, 27 Nov 2008 16:35:24 +0000 (16:35 +0000)
git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2291 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/layer.cpp

index 7643883..8fcbfbf 100644 (file)
@@ -266,7 +266,19 @@ Layer::disconnect_dynamic_param(const String& param)
        if(previous)
        {
                dynamic_param_list_.erase(param);
-               remove_child(previous.get());
+
+               // fix 2353284: if two parameters in the same layer are
+               // connected to the same valuenode and we disconnect one of
+               // them, the parent-child relationship for the remaining
+               // connection was being deleted.  now we search the parameter
+               // list to see if another parameter uses the same valuenode
+               DynamicParamList::const_iterator iter;
+               for (iter = dynamic_param_list().begin(); iter != dynamic_param_list().end(); iter++)
+                       if (iter->second == previous)
+                               break;
+               if (iter == dynamic_param_list().end())
+                       remove_child(previous.get());
+
                changed();
        }
        return true;