# HG changeset patch # User Jaroslav Hajek # Date 1231510543 -3600 # Node ID d6a349c7bd394775df34949f55baa87574bd454f # Parent 6306ce1406f17cdd8ff29da51c3ca8bbca1565b9 fix {} assigment if error occurs on subsequent assignment component diff -r 6306ce1406f1 -r d6a349c7bd39 src/ChangeLog --- a/src/ChangeLog Fri Jan 09 14:38:18 2009 +0100 +++ b/src/ChangeLog Fri Jan 09 15:15:43 2009 +0100 @@ -1,3 +1,8 @@ +2009-01-09 Jaroslav Hajek + + * ov-cell.cc (octave_cell::subsasgn): Put erased copy back after + make_unique has been called. + 2009-01-09 Kai Habel * graphics.cc: Calculate normals for surface boundaries, use diff -r 6306ce1406f1 -r d6a349c7bd39 src/ov-cell.cc --- a/src/ov-cell.cc Fri Jan 09 14:38:18 2009 +0100 +++ b/src/ov-cell.cc Fri Jan 09 15:15:43 2009 +0100 @@ -187,18 +187,22 @@ { tmp = tmp.cell_value ()(0,0); - // Erase the reference to avoid copying. - assign (idx.front (), octave_value ()); - std::list next_idx (idx); next_idx.erase (next_idx.begin ()); - // This should be a no-op. - tmp.make_unique (); - if (! tmp.is_defined () || tmp.is_zero_by_zero ()) tmp = octave_value::empty_conv (type.substr (1), rhs); + else + { + // This is a bit of black magic. tmp is a shallow copy + // of an element inside this cell, and maybe more. To + // prevent make_unique from always forcing a copy, we + // temporarily delete the stored value. + assign (idx.front (), octave_value ()); + tmp.make_unique (); + assign (idx.front (), Cell (tmp)); + } if (! error_state) t_rhs = tmp.subsasgn (type.substr (1), next_idx, rhs);