diff libinterp/octave-value/cdef-property.cc @ 29403:aef9c5caedcd

call handle class set method with nargout = 0 (bug #60143) * cdef-property.cc (cdef_property::cdef_property_rep::set_value): Call handle class set method with nargout = 0 and ignore any value the function may return.
author John W. Eaton <jwe@octave.org>
date Mon, 01 Mar 2021 20:11:59 -0500
parents 0a5b15007766
children 796f54d4ddbf
line wrap: on
line diff
--- a/libinterp/octave-value/cdef-property.cc	Mon Mar 01 15:33:37 2021 -0800
+++ b/libinterp/octave-value/cdef-property.cc	Mon Mar 01 20:11:59 2021 -0500
@@ -207,19 +207,24 @@
         args(0) = to_ov (obj);
         args(1) = val;
 
-        args = feval (set_fcn, args, 1);
+        if (obj.is_handle_object ())
+          feval (set_fcn, args, 0);
+        else
+          {
+            args = feval (set_fcn, args, 1);
 
-        if (args.length () > 0 && args(0).is_defined ())
-          {
-            if (args (0).is_classdef_object ())
+            if (args.length () > 0 && args(0).is_defined ())
               {
-                cdef_object new_obj = to_cdef (args(0));
+                if (args(0).is_classdef_object ())
+                  {
+                    cdef_object new_obj = to_cdef (args(0));
 
-                obj = new_obj;
+                    obj = new_obj;
+                  }
+                else
+                  ::warning ("set-method of property '%s' returned a non-classdef object",
+                             get_name ().c_str ());
               }
-            else
-              ::warning ("set-method of property '%s' returned a non-classdef object",
-                         get_name ().c_str ());
           }
       }
   }