# HG changeset patch # User Pantxo Diribarne # Date 1392237619 -3600 # Node ID 0cbd0d285541663251d257954cf0032ca3d27217 # Parent b26d6be1767a85541006704249fa3da100ffd3de Avoid reseting "parent" property to the same value (bug #37752). * base_properties::set_parent (graphics.cc): do nothing if current and new parent are the same * add test according to bug #37752 diff -r b26d6be1767a -r 0cbd0d285541 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Fri Jan 24 10:14:15 2014 +0100 +++ b/libinterp/corefcn/graphics.cc Wed Feb 12 21:40:19 2014 +0100 @@ -2777,7 +2777,13 @@ // Remove child from current parent graphics_object old_parent_obj; old_parent_obj = gh_manager::get_object (get_parent ()); - old_parent_obj.remove_child (__myhandle__); + + + if (old_parent_obj.get_handle () != hnp) + old_parent_obj.remove_child (__myhandle__); + else + // Do nothing more + return; // Check new parent's parent is not this child to avoid recursion graphics_object new_parent_obj; @@ -2800,6 +2806,18 @@ error ("set: expecting parent to be a graphics handle"); } +/* +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hax = gca (); +%! set (hax, "parent", gcf ()) +%! assert (gca (), hax) +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +*/ + void base_properties::mark_modified (void) {