diff --git a/libinterp/octave-value/ov-fcn-handle.cc b/libinterp/octave-value/ov-fcn-handle.cc --- a/libinterp/octave-value/ov-fcn-handle.cc +++ b/libinterp/octave-value/ov-fcn-handle.cc @@ -2690,7 +2690,9 @@ OCTAVE_NAMESPACE_BEGIN const std::shared_ptr& stack_context) : base_anonymous_fcn_handle (fcn, local_vars), m_stack_context (stack_context) - { } + { + m_stack_context->mark_closure_context (); + } octave_value anonymous_fcn_handle::make_weak_anonymous_handle (void) const {