summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclCompExpr.c6
-rw-r--r--generic/tclEvent.c38
-rw-r--r--generic/tclInt.h4
-rw-r--r--generic/tclObj.c22
5 files changed, 50 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index f96fcbc..d54268a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-03 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclCompExpr.c: Untangled some dependencies in the
+ * generic/tclEvent.c: order of finalization routines.
+ * generic/tclInt.h: [Bug 1251399]
+ * generic/tclObj.c:
+
2005-07-30 Daniel Steffen <das@users.sourceforge.net>
* unix/configure, unix/tcl.m4: revert 2005-07-28 change.
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 1465f69..68e1e11 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.13 2003/02/16 01:36:32 msofer Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.13.2.1 2005/08/03 22:23:35 dgp Exp $
*/
#include "tclInt.h"
@@ -286,9 +286,7 @@ TclCompileExpr(interp, script, numBytes, envPtr)
* TclFinalizeCompilation --
*
* Clean up the compilation environment so it can later be
- * properly reinitialized. This procedure is called by
- * TclFinalizeCompExecEnv() in tclObj.c, which in turn is called
- * by Tcl_Finalize().
+ * properly reinitialized. This procedure is called by Tcl_Finalize().
*
* Results:
* None.
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index acabcc0..c8944f7 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -11,7 +11,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.28.2.11 2005/06/24 18:21:39 kennykb Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.28.2.12 2005/08/03 22:23:42 dgp Exp $
*/
#include "tclInt.h"
@@ -833,15 +833,29 @@ Tcl_Finalize()
* order dependencies.
*/
- TclFinalizeCompExecEnv();
+ TclFinalizeCompilation();
+ TclFinalizeExecution();
TclFinalizeEnvironment();
/*
* Finalizing the filesystem must come after anything which
* might conceivably interact with the 'Tcl_FS' API.
*/
+
TclFinalizeFilesystem();
+ /*
+ * Undo all the 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
@@ -870,13 +884,6 @@ Tcl_Finalize()
Tcl_SetPanicProc(NULL);
/*
- * 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.
@@ -910,14 +917,23 @@ Tcl_Finalize()
}
#endif
+ 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) && !defined(TCL_MEM_DEBUG) && !defined(PURIFY)
TclFinalizeThreadAlloc();
#endif
+ /*
+ * At this point, there should no longer be any ckalloc'ed memory.
+ */
+
TclFinalizeMemorySubsystem();
inFinalize = 0;
}
diff --git a/generic/tclInt.h b/generic/tclInt.h
index d3f1ce1..2538772 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -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: tclInt.h,v 1.118.2.16 2005/07/05 21:18:23 dgp Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.118.2.17 2005/08/03 22:23:42 dgp Exp $
*/
#ifndef _TCLINT
@@ -1653,7 +1653,6 @@ EXTERN int TclFileRenameCmd _ANSI_ARGS_((Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])) ;
EXTERN void TclFinalizeAllocSubsystem _ANSI_ARGS_((void));
EXTERN void TclFinalizeAsync _ANSI_ARGS_((void));
-EXTERN void TclFinalizeCompExecEnv _ANSI_ARGS_((void));
EXTERN void TclFinalizeCompilation _ANSI_ARGS_((void));
EXTERN void TclFinalizeEncodingSubsystem _ANSI_ARGS_((void));
EXTERN void TclFinalizeEnvironment _ANSI_ARGS_((void));
@@ -1665,6 +1664,7 @@ EXTERN void TclFinalizeLoad _ANSI_ARGS_((void));
EXTERN void TclFinalizeLock _ANSI_ARGS_((void));
EXTERN void TclFinalizeMemorySubsystem _ANSI_ARGS_((void));
EXTERN void TclFinalizeNotifier _ANSI_ARGS_((void));
+EXTERN void TclFinalizeObjects _ANSI_ARGS_((void));
EXTERN void TclFinalizePreserve _ANSI_ARGS_((void));
EXTERN void TclFinalizeSynchronization _ANSI_ARGS_((void));
EXTERN void TclFinalizeThreadData _ANSI_ARGS_((void));
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 3cf3760..494b80e 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclObj.c,v 1.42.2.10 2005/04/20 16:06:17 dgp Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.42.2.11 2005/08/03 22:23:43 dgp Exp $
*/
#include "tclInt.h"
@@ -272,23 +272,22 @@ TclInitObjSubsystem()
/*
*----------------------------------------------------------------------
*
- * TclFinalizeCompExecEnv --
+ * TclFinalizeObjects --
*
- * This procedure is called by Tcl_Finalize to clean up the Tcl
- * compilation and execution environment so it can later be properly
- * reinitialized.
+ * This procedure is called by Tcl_Finalize to clean up all
+ * registered Tcl_ObjType's and to reset the tclFreeObjList.
*
* Results:
* None.
*
* Side effects:
- * Cleans up the compilation and execution environment
+ * None.
*
*----------------------------------------------------------------------
*/
void
-TclFinalizeCompExecEnv()
+TclFinalizeObjects()
{
Tcl_MutexLock(&tableMutex);
if (typeTableInitialized) {
@@ -296,12 +295,15 @@ TclFinalizeCompExecEnv()
typeTableInitialized = 0;
}
Tcl_MutexUnlock(&tableMutex);
+
+ /*
+ * All we do here is reset the head pointer of the linked list of
+ * free Tcl_Obj's to NULL; the memory finalization will take care
+ * of releasing memory for us.
+ */
Tcl_MutexLock(&tclObjMutex);
tclFreeObjList = NULL;
Tcl_MutexUnlock(&tclObjMutex);
-
- TclFinalizeCompilation();
- TclFinalizeExecution();
}
/*