Mercurial > octave
diff libinterp/interpfcn/symtab.cc @ 16605:2f8fb02a6c31
erase subfunctions when primary function scope is deleted (bug #38691)
* symtab.h (symbol_table::fcn_info::fcn_info_rep::clear_map):
Rename from clear_unlocked. New arg, force.
(symbol_table::fcn_info::fcn_info_rep::clear_autoload_function,
(symbol_table::fcn_info::fcn_info::clear_autoload_function,
symbol_table::fcn_info::fcn_info_rep::clear_user_function,
symbol_table::fcn_info::fcn_info::clear_user_function,
symbol_table::fcn_info::fcn_info_rep::clear,
symbol_table::fcn_info::clear, symbol_table::clear_all,
symbol_table::clear_functions.): New arg, force.
(symbol_table::erase_scope): Call erase_subfunctions_in_scope.
(symbol_table::do_pop_context, symbol_table::do_clear_global_pattern):
Style fixes.
* symtab.cc (symbol_table::cleanup): Simplify.
* test/bug-38691/module.mk, test/bug-38691/bug-38691.tst,
test/bug-38691/dir1/func1.m, test/bug-38691/dir2/func1.m,
test/bug-38691/dir2/func2.m, test/bug-38691/dir2/func3.m: New files.
* test/Makefile.am: Include bug-38691/module.mk.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 03 May 2013 01:16:41 -0400 |
parents | 8701792e16ec |
children | 856cb7cba231 |
line wrap: on
line diff
--- a/libinterp/interpfcn/symtab.cc Fri May 03 00:32:50 2013 -0400 +++ b/libinterp/interpfcn/symtab.cc Fri May 03 01:16:41 2013 -0400 @@ -1458,27 +1458,12 @@ void symbol_table::cleanup (void) { - // Clear variables in top scope. - all_instances[xtop_scope]->clear_variables (); - - // Clear function table. This is a hard clear, ignoring mlocked functions. - fcn_table.clear (); - - // Clear variables in global scope. - // FIXME: are there any? - all_instances[xglobal_scope]->clear_variables (); - - // Clear global variables. - global_table.clear (); + clear_all (true); // Delete all possibly remaining scopes. for (all_instances_iterator iter = all_instances.begin (); iter != all_instances.end (); iter++) { - scope_id scope = iter->first; - if (scope != xglobal_scope && scope != xtop_scope) - scope_id_cache::free (scope); - // First zero the table entry to avoid possible duplicate delete. symbol_table *inst = iter->second; iter->second = 0; @@ -1487,6 +1472,12 @@ // deleting other scopes. delete inst; } + + global_table.clear (); + fcn_table.clear (); + class_precedence_table.clear (); + parent_map.clear (); + all_instances.clear (); } void