# HG changeset patch # User Jaroslav Hajek # Date 1269588244 -3600 # Node ID 13c1f15c67fae00c99ecff3ddd202d20535ab376 # Parent c0c24219fccf650cf91dda14f48f46f20c925016 guard against recursive calls of missing_function_hook diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-03-26 Jaroslav Hajek + + * variables.cc (maybe_missing_function_hook): Temporarily clear before + executing the hook to avoid recursive calls. + 2010-03-25 John W. Eaton * gl2ps-renderer.cc (glps_renderer::draw): Tag call to fclose diff --git a/src/variables.cc b/src/variables.cc --- a/src/variables.cc +++ b/src/variables.cc @@ -2394,5 +2394,16 @@ { // Don't do this if we're handling errors. if (buffer_error_messages == 0 && ! Vmissing_function_hook.empty ()) - feval (Vmissing_function_hook, octave_value (name)); + { + // Ensure auto-restoration. + unwind_protect frame; + frame.protect_var (Vmissing_function_hook); + + // Clear the variable prior to calling the function. + const std::string func_name = Vmissing_function_hook; + Vmissing_function_hook.clear (); + + // Call. + feval (func_name, octave_value (name)); + } }