Mercurial > hg > octave-nkf
changeset 18517:0cbd0d285541
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
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Wed, 12 Feb 2014 21:40:19 +0100 |
parents | b26d6be1767a |
children | 2bd78ab75b23 |
files | libinterp/corefcn/graphics.cc |
diffstat | 1 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -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) {