# HG changeset patch # User Jaroslav Hajek # Date 1284318635 -7200 # Node ID 2cc9b08bfd3981a190817e20853a63135ad5fca4 # Parent 409ceee18accef3e68ea1dea64ae6e343723d39e fixes in binders code diff -r 409ceee18acc -r 2cc9b08bfd39 src/ChangeLog --- a/src/ChangeLog Fri Sep 10 11:48:41 2010 +0200 +++ b/src/ChangeLog Sun Sep 12 21:10:35 2010 +0200 @@ -1,3 +1,11 @@ +2010-09-12 Jaroslav Hajek + + * ov-fcn-handle.cc (octave_fcn_binder::maybe_binder): Stash name tags + in the template. + (octave_fcn_binder::do_multi_index_op): Don't use xelem to ensure + proper unsharing. Make a shallow copy prior to call to ensure + consistency throughout recursive calls. + 2010-09-11 Jaroslav Hajek * ov-fcn-handle.h (octave_fcn_binder): New subclass. diff -r 409ceee18acc -r 2cc9b08bfd39 src/ov-fcn-handle.cc --- a/src/ov-fcn-handle.cc Fri Sep 10 11:48:41 2010 +0200 +++ b/src/ov-fcn-handle.cc Sun Sep 12 21:10:35 2010 +0200 @@ -1900,6 +1900,11 @@ if (! bad) { + // Stash proper name tags. + std::list arg_names = idx_expr->arg_names (); + assert (arg_names.size () == 1); + arg_template.stash_name_tags (arg_names.front ()); + retval = new octave_fcn_binder (f, root_val, arg_template, arg_mask, npar); } @@ -1933,10 +1938,13 @@ { int j = arg_mask[i]; if (j >= 0) - arg_template.xelem(i) = args(j); + arg_template(i) = args(j); // May force a copy... } - retval = root_handle.do_multi_index_op (nargout, arg_template, lvalue_list); + // Make a shallow copy of arg_template, to ensure consistency throughout the following + // call even if we happen to get back here. + octave_value_list tmp (arg_template); + retval = root_handle.do_multi_index_op (nargout, tmp, lvalue_list); } else retval = octave_fcn_handle::do_multi_index_op (nargout, args, lvalue_list);