summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--generic/tclEvent.c5
-rw-r--r--generic/tclInt.h7
-rw-r--r--generic/tclPreserve.c17
4 files changed, 24 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 27ee03e..61bfe56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-06-24 Kevin Kenny <kennykb@acm.org>
+
+ * generic/tclEvent.c (Tcl_Finalize):
+ * generic/tclInt.h:
+ * generic/tclPreserve.c (TclFinalizePreserve): Changed the
+ finalization logic so that Tcl_Preserve finalizes after exit
+ handlers run; a lot of code called from Tk's exit handlers
+ presumes tha Tcl_Preserve will still work even from an exit
+ handler. Also, made the assertion check that no exit handlers
+ are created in Tcl_Finalize conditional on TCL_MEM_DEBUG to
+ avoid spurios panics in the "stable" release.
+
2005-06-24 Don Porter <dgp@users.sourceforge.net>
*** 8.4.11 TAGGED FOR RELEASE ***
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 81b6b2d..acabcc0 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.10 2005/06/22 19:35:15 kennykb Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.28.2.11 2005/06/24 18:21:39 kennykb Exp $
*/
#include "tclInt.h"
@@ -904,13 +904,16 @@ Tcl_Finalize()
* nobody's done this.
*/
+#ifdef TCL_MEM_DEBUG
if ( firstExitPtr != NULL ) {
Tcl_Panic( "exit handlers were created during Tcl_Finalize" );
}
+#endif
/*
* There shouldn't be any malloc'ed memory after this.
*/
+ TclFinalizePreserve();
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) && !defined(TCL_MEM_DEBUG) && !defined(PURIFY)
TclFinalizeThreadAlloc();
#endif
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 23bd5aa..115866d 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.14 2005/06/22 19:35:18 kennykb Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.118.2.15 2005/06/24 18:21:40 kennykb Exp $
*/
#ifndef _TCLINT
@@ -1652,6 +1652,7 @@ EXTERN int TclFileMakeDirsCmd _ANSI_ARGS_((Tcl_Interp *interp,
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));
@@ -1661,11 +1662,11 @@ EXTERN void TclFinalizeIOSubsystem _ANSI_ARGS_((void));
EXTERN void TclFinalizeFilesystem _ANSI_ARGS_((void));
EXTERN void TclResetFilesystem _ANSI_ARGS_((void));
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 TclFinalizeAsync _ANSI_ARGS_((void));
+EXTERN void TclFinalizePreserve _ANSI_ARGS_((void));
EXTERN void TclFinalizeSynchronization _ANSI_ARGS_((void));
-EXTERN void TclFinalizeLock _ANSI_ARGS_((void));
EXTERN void TclFinalizeThreadData _ANSI_ARGS_((void));
EXTERN int TclGlob _ANSI_ARGS_((Tcl_Interp *interp,
char *pattern, Tcl_Obj *unquotedPrefix,
diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c
index 04615b7..9352e84 100644
--- a/generic/tclPreserve.c
+++ b/generic/tclPreserve.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: tclPreserve.c,v 1.3.34.1 2003/07/16 21:25:07 hobbs Exp $
+ * RCS: @(#) $Id: tclPreserve.c,v 1.3.34.2 2005/06/24 18:21:41 kennykb Exp $
*/
#include "tclInt.h"
@@ -66,17 +66,11 @@ typedef struct HandleStruct {
} HandleStruct;
-/*
- * Static routines in this file:
- */
-
-static void PreserveExitProc _ANSI_ARGS_((ClientData clientData));
-
/*
*----------------------------------------------------------------------
*
- * PreserveExitProc --
+ * TclFinalizePreserve --
*
* Called during exit processing to clean up the reference array.
*
@@ -90,9 +84,8 @@ static void PreserveExitProc _ANSI_ARGS_((ClientData clientData));
*/
/* ARGSUSED */
-static void
-PreserveExitProc(clientData)
- ClientData clientData; /* NULL -Unused. */
+void
+TclFinalizePreserve()
{
Tcl_MutexLock(&preserveMutex);
if (spaceAvl != 0) {
@@ -151,8 +144,6 @@ Tcl_Preserve(clientData)
if (inUse == spaceAvl) {
if (spaceAvl == 0) {
- Tcl_CreateExitHandler((Tcl_ExitProc *) PreserveExitProc,
- (ClientData) NULL);
refArray = (Reference *) ckalloc((unsigned)
(INITIAL_SIZE*sizeof(Reference)));
spaceAvl = INITIAL_SIZE;