# HG changeset patch # User Pantxo Diribarne # Date 1664314254 -7200 # Node ID 5ea5fe592a9a13b3952073df9123ca5209b7e924 # Parent dd6b37f67db2939f39cd99717a69b64e917cbc7e Don't delete labels when reordering of axes children (bug #63117) * graphics.in.h (children_property::do_set): Avoid using a temporary variable for new children list. Rephrase error message to be more accurate. Always return true for clarity. diff -r dd6b37f67db2 -r 5ea5fe592a9a libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Sun Sep 25 06:22:25 2022 -0400 +++ b/libinterp/corefcn/graphics.in.h Tue Sep 27 23:30:54 2022 +0200 @@ -1825,12 +1825,13 @@ bool add_hidden = true; const Matrix visible_kids = do_get_children (false); + const Matrix hidden_kids = do_get_children (true); if (visible_kids.numel () == new_kids.numel ()) { Matrix t1 = visible_kids.sort (); Matrix t2 = new_kids_column.sort (); - Matrix t3 = get_hidden ().sort (); + Matrix t3 = hidden_kids.sort (); if (t1 != t2) is_ok = false; @@ -1842,22 +1843,22 @@ is_ok = false; if (! is_ok) - error ("set: new children must be a permutation of existing children"); - - Matrix tmp = new_kids_column; - - if (add_hidden) - tmp.stack (get_hidden ()); + error ("set: new children list must be a permutation of existing " + "children with visible handles"); m_children_list.clear (); // Don't use do_init_children here, as that reverses the // order of the list, and we don't want to do that if setting // the child list directly. - for (octave_idx_type i = 0; i < tmp.numel (); i++) - m_children_list.push_back (tmp.xelem (i)); - - return is_ok; + for (octave_idx_type i = 0; i < new_kids_column.numel (); i++) + m_children_list.push_back (new_kids_column.xelem (i)); + + if (add_hidden) + for (octave_idx_type i = 0; i < hidden_kids.numel (); i++) + m_children_list.push_back (hidden_kids.xelem (i)); + + return true; } private: