Mercurial > octave-nkf
changeset 19752:675d92e7d507
Temporary workaround for user-defined object sizes reported as 1x1 in GUI (bug #43096)
* symtab.cc (do_workspace_info): Don't use val.dims () directly to get
dimension vector which does not implicitly call size() for class objects.
Instead, call size() on object and create dimension vector from returned
information.
author | Colin Macdonald <cbm@m.fsf.org> |
---|---|
date | Thu, 05 Feb 2015 22:40:22 +0000 |
parents | 606b05352351 |
children | 60ce9f86ecfe |
files | libinterp/corefcn/symtab.cc libinterp/corefcn/variables.cc |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/symtab.cc Sun Feb 15 07:13:09 2015 -0800 +++ b/libinterp/corefcn/symtab.cc Thu Feb 05 22:40:22 2015 +0000 @@ -1505,7 +1505,13 @@ if (val.is_defined ()) { - dim_vector dv = val.dims (); + // FIXME: fix size for objects, see kluge in variables.cc + //dim_vector dv = val.dims (); + octave_value tmp = val; + Matrix sz = tmp.size (); + dim_vector dv = dim_vector::alloc (sz.numel ()); + for (octave_idx_type i = 0; i < dv.length (); i++) + dv(i) = sz(i); char storage = ' '; if (sr.is_global ())
--- a/libinterp/corefcn/variables.cc Sun Feb 15 07:13:09 2015 -0800 +++ b/libinterp/corefcn/variables.cc Thu Feb 05 22:40:22 2015 +0000 @@ -1113,6 +1113,7 @@ // and if val is an object, expect that dims will call size if it is // overloaded by a user-defined method. But there are currently some // unresolved const issues that prevent that solution from working. +// This same kluge is done in symtab.cc (do_workspace_info), fix there too. std::string get_dims_str (const octave_value& val)