Mercurial > hg > octave-nkf
diff src/variables.cc @ 10467:13c1f15c67fa
guard against recursive calls of missing_function_hook
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 26 Mar 2010 08:24:04 +0100 |
parents | 537d9fbba9c0 |
children | 4d1fc073fbb7 |
line wrap: on
line diff
--- 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)); + } }