From: dooglus Date: Sun, 23 Nov 2008 21:27:12 +0000 (+0000) Subject: Fix 2321845: "Save after delete a keyframe crash in a particular file". This bug... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=1997822b3fc97e99a787c54d80c0a721ac750109;p=synfig.git Fix 2321845: "Save after delete a keyframe crash in a particular file". This bug was introduced by r2205. Use canvas->add_value_node() to export values rather than setting the id explicitly. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2260 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/synfigapp/actions/waypointremove.cpp b/synfig-studio/trunk/src/synfigapp/actions/waypointremove.cpp index 64bdcf6..d79b21d 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/waypointremove.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/waypointremove.cpp @@ -141,13 +141,19 @@ Action::WaypointRemove::perform() throw Error(_("Unable to create ValueNode_Reference")); } + // fix 2256600 (and 2321845) : deleting the last waypoint of an exported valuenode unexported it + // if the waypoint's value isn't exported, set its id to be the id of the parent node + if (value_node_ref->get_id() == "" && value_node->get_id() != "") + { + const String id(value_node->get_id()); + Canvas::LooseHandle canvas(value_node->get_parent_canvas()); + canvas->remove_value_node(value_node); + canvas->add_value_node(value_node_ref, id); + } + value_node->replace(value_node_ref); value_node->waypoint_list().clear(); - // fix 2256600 : deleting the last waypoint of an exported valuenode unexported it - // if the waypoint's value isn't exported, set its id to be the id of the parent node - if (value_node_ref->get_id() == "") value_node_ref->set_id(value_node->get_id()); - if(get_canvas_interface()) { get_canvas_interface()->signal_value_node_replaced()(value_node,value_node_ref); @@ -165,6 +171,14 @@ Action::WaypointRemove::undo() if(value_node->waypoint_list().size()!=0) throw Error(_("This animated value node should be empty, but for some reason it isn't. This is a bug. (1)")); + if (value_node->get_id() == "" && value_node_ref->get_id() != "") + { + const String id(value_node_ref->get_id()); + Canvas::LooseHandle canvas(value_node_ref->get_parent_canvas()); + canvas->remove_value_node(value_node_ref); + canvas->add_value_node(value_node, id); + } + value_node_ref->replace(value_node); waypoint.set_value_node(value_node_ref);