Fix 1380227: crash when changing keyframes. Patch by Chris Moore (dooglus)
authorpabs <pabs@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 3 Feb 2007 23:49:50 +0000 (23:49 +0000)
committerpabs <pabs@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 3 Feb 2007 23:49:50 +0000 (23:49 +0000)
git-svn-id: http://svn.voria.com/code@234 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/synfigapp/actions/keyframeduplicate.cpp
synfig-studio/trunk/src/synfigapp/actions/keyframeremove.cpp
synfig-studio/trunk/src/synfigapp/actions/keyframeset.cpp
synfig-studio/trunk/src/synfigapp/canvasinterface.cpp

index 94bf215..eb8493e 100644 (file)
@@ -164,13 +164,13 @@ Action::KeyframeDuplicate::process_value_desc(const synfigapp::ValueDesc& value_
                // If we are a dynamic list, then we need to update the ActivePoints
                if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
                {
-                       ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
+                       ValueNode_DynamicList::Handle value_node_dynamic(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
                        int i;
                        
-                       for(i=0;i<value_node->link_count();i++)
+                       for(i=0;i<value_node_dynamic->link_count();i++)
                        {
-                               synfigapp::ValueDesc value_desc(value_node,i);
-                               Activepoint activepoint(value_node->list[i].new_activepoint_at_time(old_time));
+                               synfigapp::ValueDesc value_desc(value_node_dynamic,i);
+                               Activepoint activepoint(value_node_dynamic->list[i].new_activepoint_at_time(old_time));
                                activepoint.set_time(new_time);
 
                                Action::Handle action(ActivepointSetSmart::create());
@@ -189,15 +189,15 @@ Action::KeyframeDuplicate::process_value_desc(const synfigapp::ValueDesc& value_
                }
                else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
                {
-                       ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
-                       Waypoint waypoint(value_node->new_waypoint_at_time(old_time));
+                       ValueNode_Animated::Handle value_node_animated(ValueNode_Animated::Handle::cast_dynamic(value_node));
+                       Waypoint waypoint(value_node_animated->new_waypoint_at_time(old_time));
                        waypoint.set_time(new_time);
                        
                        Action::Handle action(WaypointSetSmart::create());
                        
                        action->set_param("canvas",get_canvas());
                        action->set_param("canvas_interface",get_canvas_interface());
-                       action->set_param("value_node",ValueNode::Handle(value_node));
+                       action->set_param("value_node",ValueNode::Handle(value_node_animated));
                        action->set_param("waypoint",waypoint);
        
                        assert(action->is_ready());
index d6915f5..b1a14da 100644 (file)
@@ -142,15 +142,15 @@ Action::KeyframeRemove::process_value_desc(const synfigapp::ValueDesc& value_des
                // If we are a dynamic list, then we need to update the ActivePoints
                if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
                {
-                       ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
+                       ValueNode_DynamicList::Handle value_node_dynamic(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
                        int i;
-                       for(i=0;i<value_node->link_count();i++)
+                       for(i=0;i<value_node_dynamic->link_count();i++)
                        try
                        {
                                Activepoint activepoint;
-                               activepoint=*value_node->list[i].find(time);
+                               activepoint=*value_node_dynamic->list[i].find(time);
 
-                               synfigapp::ValueDesc value_desc(value_node,i);
+                               synfigapp::ValueDesc value_desc(value_node_dynamic,i);
 
                                Action::Handle action(ActivepointRemove::create());
                                
@@ -172,16 +172,16 @@ Action::KeyframeRemove::process_value_desc(const synfigapp::ValueDesc& value_des
                else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
                try
                {
-                       ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
+                       ValueNode_Animated::Handle value_node_animated(ValueNode_Animated::Handle::cast_dynamic(value_node));
                        Waypoint waypoint;
-                       waypoint=*value_node->find(time);
+                       waypoint=*value_node_animated->find(time);
                        assert(waypoint.get_time()==time);
                        
                        Action::Handle action(WaypointRemove::create());
                        
                        action->set_param("canvas",get_canvas());
                        action->set_param("canvas_interface",get_canvas_interface());
-                       action->set_param("value_node",ValueNode::Handle(value_node));
+                       action->set_param("value_node",ValueNode::Handle(value_node_animated));
                        action->set_param("waypoint",waypoint);
        
                        assert(action->is_ready());
index a2b2a84..bfbee21 100644 (file)
@@ -275,11 +275,11 @@ Action::KeyframeSet::process_value_desc(const synfigapp::ValueDesc& value_desc)
                // If we are a dynamic list, then we need to update the ActivePoints
                if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
                {
-                       ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
+                       ValueNode_DynamicList::Handle value_node_dynamic(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
                        int i;
-                       for(i=0;i<value_node->link_count();i++)
+                       for(i=0;i<value_node_dynamic->link_count();i++)
                        {
-                               synfigapp::ValueDesc value_desc(value_node,i);
+                               synfigapp::ValueDesc value_desc(value_node_dynamic,i);
                                if(new_time>keyframe_prev && new_time<keyframe_next)
                                {
                                        // In this circumstance, we need to adjust any
@@ -299,13 +299,13 @@ Action::KeyframeSet::process_value_desc(const synfigapp::ValueDesc& value_desc)
                                        Activepoint activepoint;
                                        try
                                        {
-                                               activepoint=*value_node->list[i].find(old_time);
+                                               activepoint=*value_node_dynamic->list[i].find(old_time);
                                                activepoint.set_time(new_time);
                                        }
                                        catch(...)
                                        {
                                                activepoint.set_time(new_time);
-                                               activepoint.set_state(value_node->list[i].status_at_time(old_time));
+                                               activepoint.set_state(value_node_dynamic->list[i].status_at_time(old_time));
                                                activepoint.set_priority(0);
                                        }
                                        action->set_param("activepoint",activepoint);
@@ -330,24 +330,24 @@ Action::KeyframeSet::process_value_desc(const synfigapp::ValueDesc& value_desc)
                        }
                        //else
                        {
-                               ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
+                               ValueNode_Animated::Handle value_node_animated(ValueNode_Animated::Handle::cast_dynamic(value_node));
                                
                                Action::Handle action(WaypointSetSmart::create());
                                
                                action->set_param("canvas",get_canvas());
                                action->set_param("canvas_interface",get_canvas_interface());
-                               action->set_param("value_node",ValueNode::Handle(value_node));
+                               action->set_param("value_node",ValueNode::Handle(value_node_animated));
                                
                                Waypoint waypoint;
                                try
                                {
-                                       waypoint=*value_node->find(old_time);
+                                       waypoint=*value_node_animated->find(old_time);
                                        waypoint.set_time(new_time);
                                }
                                catch(...)
                                {
                                        waypoint.set_time(new_time);
-                                       waypoint.set_value((*value_node)(old_time));
+                                       waypoint.set_value((*value_node_animated)(old_time));
                                }
                                action->set_param("waypoint",waypoint);
                
index a669d1b..e89fff7 100644 (file)
@@ -748,13 +748,13 @@ _process_value_desc(const synfigapp::ValueDesc& value_desc,std::vector<synfigapp
                                ret++;
                        }
                        // Process the linkable ValueNode's children
-                       LinkableValueNode::Handle value_node(LinkableValueNode::Handle::cast_dynamic(value_node));
+                       LinkableValueNode::Handle value_node_copy(LinkableValueNode::Handle::cast_dynamic(value_node));
                        int i;
-                       for(i=0;i<value_node->link_count();i++)
+                       for(i=0;i<value_node_copy->link_count();i++)
                        {
-                               ValueNode::Handle link(value_node->get_link(i));
+                               ValueNode::Handle link(value_node_copy->get_link(i));
                                if(!link->is_exported())
-                                       ret+=_process_value_desc(ValueDesc(value_node,i),out,guid_set);
+                                       ret+=_process_value_desc(ValueDesc(value_node_copy,i),out,guid_set);
                        }
                }
                else if(ValueNode_Animated::Handle::cast_dynamic(value_node))