changeset 31020:a4a010d40459

maint: merge stable to default
author Rik <rik@octave.org>
date Tue, 24 May 2022 11:38:00 -0700
parents ab5a4df64bc3 (current diff) 490e8a6107d0 (diff)
children 3cb50bb91ccf
files libinterp/octave-value/ov-fcn-handle.cc
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-fcn-handle.cc	Mon May 23 21:02:49 2022 -0700
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Tue May 24 11:38:00 2022 -0700
@@ -396,7 +396,8 @@
                        const std::shared_ptr<stack_frame>& stack_context)
       : base_nested_fcn_handle (fcn, name), m_stack_context (stack_context)
     {
-      m_stack_context->mark_closure_context ();
+      if (m_stack_context)
+        m_stack_context->mark_closure_context ();
     }
 
     nested_fcn_handle (const nested_fcn_handle&) = default;
@@ -2697,7 +2698,10 @@
                                               const std::shared_ptr<stack_frame>& stack_context)
     : base_anonymous_fcn_handle (fcn, local_vars),
       m_stack_context (stack_context)
-  { }
+  {
+    if (m_stack_context)
+      m_stack_context->mark_closure_context ();
+  }
 
   octave_value anonymous_fcn_handle::make_weak_anonymous_handle (void) const
   {