summaryrefslogtreecommitdiffstats
path: root/generic/tclEvent.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2005-06-22 19:35:10 (GMT)
committerKevin B Kenny <kennykb@acm.org>2005-06-22 19:35:10 (GMT)
commit37d7859f69fa858cde620a429a5616ced9059d3f (patch)
treeac752dcd448c2800fec0ea4fc60c787b9998a0c5 /generic/tclEvent.c
parent7164775ff1dd6d93ea1029b267d07872a35a62f8 (diff)
downloadtcl-37d7859f69fa858cde620a429a5616ced9059d3f.zip
tcl-37d7859f69fa858cde620a429a5616ced9059d3f.tar.gz
tcl-37d7859f69fa858cde620a429a5616ced9059d3f.tar.bz2
bug 1225727
Diffstat (limited to 'generic/tclEvent.c')
-rw-r--r--generic/tclEvent.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 059871c..81b6b2d 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.9 2004/07/30 15:15:57 dgp Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.28.2.10 2005/06/22 19:35:15 kennykb Exp $
*/
#include "tclInt.h"
@@ -895,11 +895,26 @@ Tcl_Finalize()
TclResetFilesystem();
/*
+ * There have been several bugs in the past that cause
+ * exit handlers to be established during Tcl_Finalize
+ * processing. Such exit handlers leave malloc'ed memory,
+ * and Tcl_FinalizeThreadAlloc or Tcl_FinalizeMemorySubsystem
+ * will result in a corrupted heap. The result can be a
+ * mysterious crash on process exit. Check here that
+ * nobody's done this.
+ */
+
+ if ( firstExitPtr != NULL ) {
+ Tcl_Panic( "exit handlers were created during Tcl_Finalize" );
+ }
+
+ /*
* There shouldn't be any malloc'ed memory after this.
*/
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) && !defined(TCL_MEM_DEBUG) && !defined(PURIFY)
TclFinalizeThreadAlloc();
#endif
+
TclFinalizeMemorySubsystem();
inFinalize = 0;
}