Mercurial > hg > octave-avbm
changeset 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 | c0c24219fccf |
children | 197b096001b7 |
files | src/ChangeLog src/variables.cc |
diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-03-26 Jaroslav Hajek <highegg@gmail.com> + + * variables.cc (maybe_missing_function_hook): Temporarily clear before + executing the hook to avoid recursive calls. + 2010-03-25 John W. Eaton <jwe@octave.org> * gl2ps-renderer.cc (glps_renderer::draw): Tag call to fclose
--- 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)); + } }