Fix 1380227: crash when changing keyframes. Patch by Chris Moore (dooglus)
[synfig.git] / synfig-studio / trunk / src / synfigapp / actions / keyframeset.cpp
index 62c7859..bfbee21 100644 (file)
@@ -5,16 +5,17 @@
 **     $Id: keyframeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
@@ -274,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
@@ -298,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);
@@ -329,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);