X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Fcanvasinterface.cpp;h=15e6efcb1db1a1fdb7cbefbdea7877708eb48432;hb=76c41442dff7ef40dd09f583a4fddf0b43488acc;hp=31f36ee8dd48c758163ece3a670f46c13caab34d;hpb=8dc81cf9659f3729a91011f0c4e9da5207e5b6d9;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp b/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp index 31f36ee..15e6efc 100644 --- a/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp +++ b/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp @@ -91,7 +91,8 @@ CanvasInterface::CanvasInterface(etl::loose_handle instance,etl::handl CanvasInterface::~CanvasInterface() { - synfig::info("synfigapp::CanvasInterface::~CanvasInterface(): Deleted"); + if (getenv("SYNFIG_DEBUG_DESTRUCTORS")) + synfig::info("CanvasInterface::~CanvasInterface(): Deleted"); } void @@ -266,7 +267,8 @@ CanvasInterface::add_layer_to(synfig::String name, synfig::Canvas::Handle canvas return 0; } - synfig::info("DEPTH=%d",depth); + // synfig::info("DEPTH=%d",depth); + // Action to move the layer (if necessary) if(depth>0) { @@ -377,7 +379,18 @@ CanvasInterface::generate_param_list(const ValueDesc &value_desc) param_list.add("value_node",value_desc.get_value_node()); if(value_desc.is_const()) - param_list.add("value",value_desc.get_value()); + { + // Fix 1868911: if we put a ValueBase holding a Canvas handle + // into the param_list and then export the canvas, the handle + // will miss out of having its reference count reduced, + // because by the time the handle is destructed the canvas + // will no longer be inline. So let's not propogate that + // ValueBase any further than here. + if (value_desc.get_value_type() == ValueBase::TYPE_CANVAS) + param_list.add("value",Canvas::LooseHandle(value_desc.get_value().get(Canvas::LooseHandle()))); + else + param_list.add("value",value_desc.get_value()); + } if(value_desc.parent_is_layer_param()) { @@ -599,6 +612,13 @@ CanvasInterface::import(const synfig::String &filename, bool /*copy*/) void CanvasInterface::waypoint_duplicate(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint) { + ValueNode::Handle value_node(); + waypoint_duplicate(value_desc.get_value_node(), waypoint); +} + +void +CanvasInterface::waypoint_duplicate(ValueNode::Handle value_node,synfig::Waypoint waypoint) +{ Action::Handle action(Action::create("waypoint_set_smart")); assert(action); @@ -608,8 +628,6 @@ CanvasInterface::waypoint_duplicate(synfigapp::ValueDesc value_desc,synfig::Wayp waypoint.make_unique(); waypoint.set_time(get_time()); - ValueNode::Handle value_node(value_desc.get_value_node()); - action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",etl::loose_handle(this)); action->set_param("waypoint",waypoint); @@ -623,14 +641,19 @@ CanvasInterface::waypoint_duplicate(synfigapp::ValueDesc value_desc,synfig::Wayp void CanvasInterface::waypoint_remove(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint) { + ValueNode::Handle value_node(); + waypoint_remove(value_desc.get_value_node(), waypoint); +} + +void +CanvasInterface::waypoint_remove(ValueNode::Handle value_node,synfig::Waypoint waypoint) +{ Action::Handle action(Action::create("waypoint_remove")); assert(action); if(!action) return; - ValueNode::Handle value_node(value_desc.get_value_node()); - action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",etl::loose_handle(this)); action->set_param("waypoint",waypoint);