File tree Expand file tree Collapse file tree 5 files changed +28
-0
lines changed
Expand file tree Collapse file tree 5 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -541,6 +541,13 @@ cdef_object_array::fill_empty_values (Array<cdef_object>& arr)
541541 }
542542}
543543
544+ void
545+ cdef_object_array::break_closure_cycles (const std::shared_ptr<stack_frame>& frame)
546+ {
547+ for (octave_idx_type i = 0 ; i < m_array.numel (); i++)
548+ m_array (i).break_closure_cycles (frame);
549+ }
550+
544551void
545552cdef_object_scalar::break_closure_cycles (const std::shared_ptr<stack_frame>& frame)
546553{
Original file line number Diff line number Diff line change @@ -414,6 +414,9 @@ class OCTINTERP_API cdef_object_array : public cdef_object_base
414414
415415 dim_vector dims () const { return m_array.dims (); }
416416
417+ OCTINTERP_API void
418+ break_closure_cycles (const std::shared_ptr<stack_frame>& frame);
419+
417420 bool is_valid () const { return true ; }
418421
419422 bool is_array () const { return true ; }
Original file line number Diff line number Diff line change 1+ function fcn = cdef_array_break_cycles ()
2+ obj_array(1 ) = foo_value_class ();
3+ obj_array(2 ) = foo_value_class ();
4+
5+ function result = nested_func (x )
6+ result = obj_array ;
7+ endfunction
8+
9+ fcn = @nested_func ;
10+ endfunction
Original file line number Diff line number Diff line change 219219%!error <duplicate method> A = class_bug66930A ([1 2 3 ], 3 );
220220%!error <duplicate property> B = class_bug66930B ([1 2 3 ], 3 );
221221
222+ ## break closure cycles for classdef arrays
223+ %!test <*67749 >
224+ %! fcn = cdef_array_break_cycles ();
225+ %! result = fcn ([]);
226+ %! assert (numel (result), 2 );
227+ %! assert (class (result), " foo_value_class" );
228+
222229## duplicate definitions of methods in parent classes (bug #50011 )
223230%!error <method .* conflicting>
224231%! cls_50011 = class_bug50011_1 ();
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ classdef_TEST_FILES = \
44 %reldir%/@class_bug67362/class_bug67362.m \
55 %reldir%/@class_bug67362/shared_name.m \
66 %reldir%/bug_60763.m \
7+ %reldir%/cdef_array_break_cycles.m \
78 %reldir%/class_bug50011_1.m \
89 %reldir%/class_bug50011_1A.m \
910 %reldir%/class_bug50011_1B.m \
You can’t perform that action at this time.
0 commit comments