summaryrefslogtreecommitdiffstats
path: root/generic/tclEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclEvent.c')
-rw-r--r--generic/tclEvent.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index e70ce67..66c8f85 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEvent.c,v 1.60 2005/07/17 21:17:40 dkf Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.61 2005/08/03 22:25:11 dgp Exp $
*/
#include "tclInt.h"
@@ -874,7 +874,8 @@ Tcl_Finalize()
* done after the exit handlers, because there are order dependencies.
*/
- TclFinalizeCompExecEnv();
+ TclFinalizeCompilation();
+ TclFinalizeExecution();
TclFinalizeEnvironment();
/*
@@ -884,6 +885,18 @@ Tcl_Finalize()
TclFinalizeFilesystem();
+ /*
+ * Undo all Tcl_ObjType registrations, and reset the master list
+ * of free Tcl_Obj's. After this returns, no more Tcl_Obj's should
+ * be allocated or freed.
+ *
+ * Note in particular that TclFinalizeObjects() must follow
+ * TclFinalizeFilesystem() because TclFinalizeFilesystem free's
+ * the Tcl_Obj that holds the path of the current working directory.
+ */
+
+ TclFinalizeObjects();
+
/*
* We must be sure the encoding finalization doesn't need to examine
* the filesystem in any way. Since it only needs to clean up
@@ -909,13 +922,6 @@ Tcl_Finalize()
TclFinalizeThreadData();
/*
- * Free synchronization objects. There really should only be one
- * thread alive at this moment.
- */
-
- TclFinalizeSynchronization();
-
- /*
* We defer unloading of packages until very late to avoid memory
* access issues. Both exit callbacks and synchronization variables
* may be stored in packages.
@@ -952,14 +958,23 @@ Tcl_Finalize()
Tcl_Panic("exit handlers were created during Tcl_Finalize");
}
+ TclFinalizePreserve();
+
/*
- * There shouldn't be any malloc'ed memory after this.
+ * Free synchronization objects. There really should only be one
+ * thread alive at this moment.
*/
- TclFinalizePreserve();
+ TclFinalizeSynchronization();
+
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
TclFinalizeThreadAlloc();
#endif
+
+ /*
+ * At this point, there should no longer be any ckalloc'ed memory.
+ */
+
TclFinalizeMemorySubsystem();
inFinalize = 0;
}