Index: generic/tclNamesp.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclNamesp.c,v
retrieving revision 1.84
diff -u -r1.84 tclNamesp.c
--- generic/tclNamesp.c	14 Sep 2005 18:35:56 -0000	1.84
+++ generic/tclNamesp.c	31 Oct 2005 19:17:07 -0000
@@ -1019,15 +1019,6 @@
     int i;
 
     /*
-     * Start by destroying the namespace's variable table, since variables
-     * might trigger traces. Variable table should be cleared but not freed!
-     * TclDeleteVars frees it, so we reinitialize it afterwards.
-     */
-
-    TclDeleteVars(iPtr, &nsPtr->varTable);
-    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.
@@ -1058,6 +1049,15 @@
     nsPtr->parentPtr = NULL;
 
     /*
+     * Destroy the namespace's variable table
+     * Variable table should be cleared but not freed!
+     * TclDeleteVars frees it, so we reinitialize it afterwards.
+     */
+
+    TclDeleteVars(iPtr, &nsPtr->varTable);
+    Tcl_InitHashTable(&nsPtr->varTable, TCL_STRING_KEYS);
+
+    /*
      * Delete the namespace path if one is installed.
      */
 
Index: tests/trace.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/trace.test,v
retrieving revision 1.41
diff -u -r1.41 trace.test
--- tests/trace.test	29 Oct 2005 19:16:32 -0000	1.41
+++ tests/trace.test	31 Oct 2005 19:17:09 -0000
@@ -1179,7 +1179,7 @@
     namespace delete ::ref
     rename doTrace {}
     set info
-} 1110
+} 1010
 
 # Delete arrays when done, so they can be re-used as scalars
 # elsewhere.
