diff src/ov-struct.cc @ 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 604e13a89c7f
children df1a3e0ebbff
line wrap: on
line diff
--- a/src/ov-struct.cc	Thu Jun 24 08:02:26 2010 +0200
+++ b/src/ov-struct.cc	Thu Jun 24 10:14:44 2010 +0200
@@ -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;
     }