Mercurial > hg > octave-terminal
changeset 10747:58c1b5402588
fix a showstopping bug in octave_fields reference counting
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 24 Jun 2010 10:14:44 +0200 |
parents | 93422177b697 |
children | d699a6c63263 |
files | src/oct-map.h src/ov-struct.cc |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/oct-map.h +++ b/src/oct-map.h @@ -80,7 +80,7 @@ operator = (const octave_fields& o) { o.rep->count++; - if (--rep->count) + if (--rep->count == 0) delete rep; rep = o.rep;
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -1724,10 +1724,12 @@ // Note that struct () creates a 1x1 struct with no fields for // compatibility with Matlab. + if (nargin == 1 && args(0).is_map ()) + return args(0); + if (nargin == 1 && args(0).is_object ()) { - octave_map m = args(0).map_value (); - retval = octave_value (new octave_struct (m)); + retval = args(0).map_value (); return retval; }