diff options
| author | dgp@users.sourceforge.net <dgp> | 2005-07-26 16:21:30 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2005-07-26 16:21:30 (GMT) |
| commit | e1c9493588325766d28c0a0defe89c377537b431 (patch) | |
| tree | 6a7f5088733fb6d6609d7f6053d0744fdeb2044c /generic/tclNamesp.c | |
| parent | b63e94f53f3f0b91fc9b1cccb1bd030d7a2e628b (diff) | |
| download | tcl-e1c9493588325766d28c0a0defe89c377537b431.zip tcl-e1c9493588325766d28c0a0defe89c377537b431.tar.gz tcl-e1c9493588325766d28c0a0defe89c377537b431.tar.bz2 | |
* generic/tclNamesp.c (TclTeardownNamespace): Re-ordering so that
* tests/trace.test (trace-34.4): command delete traces fire
while the command still exists. [Bug 1047286]
Diffstat (limited to 'generic/tclNamesp.c')
| -rw-r--r-- | generic/tclNamesp.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 9230cf0..3367af9 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -21,7 +21,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.80 2005/07/17 21:17:43 dkf Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.81 2005/07/26 16:21:31 dgp Exp $ */ #include "tclInt.h" @@ -1055,6 +1055,23 @@ TclTeardownNamespace(nsPtr) Tcl_InitHashTable(&nsPtr->varTable, TCL_STRING_KEYS); /* + * Delete all commands in this namespace. Be careful when traversing the + * hash table: when each command is deleted, it removes itself from the + * command table. + * + * Don't optimize to Tcl_NextHashEntry() because of traces. + */ + + for (entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search); + entryPtr != NULL; + entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search)) { + cmd = (Tcl_Command) Tcl_GetHashValue(entryPtr); + Tcl_DeleteCommandFromToken((Tcl_Interp *) iPtr, cmd); + } + Tcl_DeleteHashTable(&nsPtr->cmdTable); + Tcl_InitHashTable(&nsPtr->cmdTable, TCL_STRING_KEYS); + + /* * Remove the namespace from its parent's child hashtable. */ @@ -1102,23 +1119,6 @@ TclTeardownNamespace(nsPtr) } /* - * Delete all commands in this namespace. Be careful when traversing the - * hash table: when each command is deleted, it removes itself from the - * command table. - * - * Don't optimize to Tcl_NextHashEntry() because of traces. - */ - - for (entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search); - entryPtr != NULL; - entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search)) { - cmd = (Tcl_Command) Tcl_GetHashValue(entryPtr); - Tcl_DeleteCommandFromToken((Tcl_Interp *) iPtr, cmd); - } - Tcl_DeleteHashTable(&nsPtr->cmdTable); - Tcl_InitHashTable(&nsPtr->cmdTable, TCL_STRING_KEYS); - - /* * Free the namespace's export pattern array. */ |
