From 73064e4b76a9357a6054724dc8dda93a6fec52e9 Mon Sep 17 00:00:00 2001 From: vincentdarley Date: Fri, 10 Jan 2003 15:03:49 +0000 Subject: WinTcl crash on exit fix --- ChangeLog | 10 ++++++++++ generic/tclIOUtil.c | 11 ++++++++++- win/makefile.vc | 3 +-- win/tclWinInit.c | 14 +++++++------- win/tclWinInt.h | 3 ++- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index d482d7a..e586bc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-01-10 Vince Darley + + * generic/tclIOUtil.c: + * win/tclWinInt.h: + * win/tclWinInit.c: fix to new WinTcl crash on exit with vfs, + introduced on 2002-12-06. Encodings must be cleaned up after + the filesystem. + + * win/makefile.vc: fix to minor VC++ 5.2 syntax problem + 2003-01-09 Don Porter * generic/tclCompCmds.c (TclCompilerReturnCmd): Corrected off-by-one diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index b1bca76..e74e94e 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.68 2003/01/09 10:38:29 vincentdarley Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.69 2003/01/10 15:03:53 vincentdarley Exp $ */ #include "tclInt.h" @@ -654,6 +654,15 @@ TclFinalizeFilesystem() { #ifdef TCL_THREADS filesystemOkToModify = NULL; #endif + /* + * Cleans up the win32 API filesystem proc lookup table and + * any special encodings which have been loaded. This must + * happen after the filesystem has been closed down, or crashes + * can result (especially with vfs). + */ +#ifdef __WIN32__ + TclWinFilesystemAndEncodingsCleanup(); +#endif } /* diff --git a/win/makefile.vc b/win/makefile.vc index 1ecb1fd..cecfab3 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,7 +12,7 @@ # Copyright (c) 2001-2002 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.98 2003/01/05 00:44:24 davygrvy Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.99 2003/01/10 15:03:54 vincentdarley Exp $ #------------------------------------------------------------------------------ !if "$(MSVCDIR)" == "" @@ -709,7 +709,6 @@ $< install-binaries: @echo Installing to '$(_INSTALLDIR)' - @echo. @echo installing $(TCLLIBNAME) !if "$(TCLLIB)" != "$(TCLIMPLIB)" @$(CPY) "$(TCLLIB)" "$(BIN_INSTALL_DIR)\" diff --git a/win/tclWinInit.c b/win/tclWinInit.c index bc0c980..186bb89 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclWinInit.c,v 1.36 2002/12/06 23:22:59 hobbs Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.37 2003/01/10 15:03:55 vincentdarley Exp $ */ #include "tclWinInt.h" @@ -465,10 +465,12 @@ ToUtf( /* *--------------------------------------------------------------------------- * - * WinEncodingsCleanup -- + * TclWinFilesystemAndEncodingsCleanup -- * * Reset information to its original state in finalization to - * allow for reinitialization to be possible. + * allow for reinitialization to be possible. This must not + * be called until after the filesystem has been finalised, or + * exit crashes may occur when using virtual filesystems. * * Results: * None. @@ -479,8 +481,8 @@ ToUtf( *--------------------------------------------------------------------------- */ -static void -WinEncodingsCleanup(ClientData clientData) +void +TclWinFilesystemAndEncodingsCleanup() { TclWinResetInterfaces(); libraryPathEncodingFixed = 0; @@ -565,8 +567,6 @@ TclpSetInitialEncodings() encoding = "iso8859-1"; binaryEncoding = Tcl_GetEncoding(NULL, encoding); } - - Tcl_CreateExitHandler(WinEncodingsCleanup, NULL); } /* diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 6a65f04..c9be10d 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinInt.h,v 1.18 2003/01/09 10:38:35 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinInt.h,v 1.19 2003/01/10 15:03:55 vincentdarley Exp $ */ #ifndef _TCLWININT @@ -112,6 +112,7 @@ EXTERN TclWinProcs *tclWinProcs; * stubs table. */ +EXTERN void TclWinFilesystemAndEncodingsCleanup(); EXTERN void TclWinInit(HINSTANCE hInst); EXTERN int TclWinSymLinkCopyDirectory(CONST TCHAR* LinkOriginal, CONST TCHAR* LinkCopy); -- cgit v0.12