summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2005-06-24 20:07:08 (GMT)
committerKevin B Kenny <kennykb@acm.org>2005-06-24 20:07:08 (GMT)
commiteee8927e2b314d25d605dbf6337ba7d5ed5a8a46 (patch)
tree92f6646260678c2a5a490c82febb89f3dc354f98
parent71740887a1b116bd5a298e4fcc67cf486fa56149 (diff)
downloadtcl-eee8927e2b314d25d605dbf6337ba7d5ed5a8a46.zip
tcl-eee8927e2b314d25d605dbf6337ba7d5ed5a8a46.tar.gz
tcl-eee8927e2b314d25d605dbf6337ba7d5ed5a8a46.tar.bz2
cleanup Tcl_Preserve after exit handlers
-rw-r--r--ChangeLog10
-rw-r--r--generic/tclEvent.c3
-rw-r--r--generic/tclInt.h7
-rw-r--r--generic/tclPreserve.c17
4 files changed, 20 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b57f16..6544b3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-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.
+
2005-06-24 Don Porter <dgp@users.sourceforge.net>
* library/auto.tcl: Make file safe to re-[source] without
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 3ecf3f1..fb58f0f 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.58 2005/06/22 19:47:42 kennykb Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.59 2005/06/24 20:07:21 kennykb Exp $
*/
#include "tclInt.h"
@@ -962,6 +962,7 @@ Tcl_Finalize()
/*
* There shouldn't be any malloc'ed memory after this.
*/
+ TclFinalizePreserve();
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
TclFinalizeThreadAlloc();
#endif
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 4d13329..4219d86 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.239 2005/06/22 19:48:08 kennykb Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.240 2005/06/24 20:07:21 kennykb Exp $
*/
#ifndef _TCLINT
@@ -1931,6 +1931,7 @@ MODULE_SCOPE int TclFileMakeDirsCmd _ANSI_ARGS_((Tcl_Interp *interp,
MODULE_SCOPE int TclFileRenameCmd _ANSI_ARGS_((Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])) ;
MODULE_SCOPE void TclFinalizeAllocSubsystem _ANSI_ARGS_((void));
+MODULE_SCOPE void TclFinalizeAsync _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeCompExecEnv _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeCompilation _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeDoubleConversion _ANSI_ARGS_((void));
@@ -1941,11 +1942,11 @@ MODULE_SCOPE void TclFinalizeIOSubsystem _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeFilesystem _ANSI_ARGS_((void));
MODULE_SCOPE void TclResetFilesystem _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeLoad _ANSI_ARGS_((void));
+MODULE_SCOPE void TclFinalizeLock _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeMemorySubsystem _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeNotifier _ANSI_ARGS_((void));
-MODULE_SCOPE void TclFinalizeAsync _ANSI_ARGS_((void));
+MODULE_SCOPE void TclFinalizePreserve _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeSynchronization _ANSI_ARGS_((void));
-MODULE_SCOPE void TclFinalizeLock _ANSI_ARGS_((void));
MODULE_SCOPE void TclFinalizeThreadData _ANSI_ARGS_((void));
MODULE_SCOPE void TclFormatNaN _ANSI_ARGS_((double value, char* buffer));
MODULE_SCOPE int TclFSFileAttrIndex _ANSI_ARGS_((Tcl_Obj *pathPtr,
diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c
index 624675e..cea5725 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.5 2003/12/24 04:18:20 davygrvy Exp $
+ * RCS: @(#) $Id: tclPreserve.c,v 1.6 2005/06/24 20:07:22 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;