From 2b17014256a8e898ed0d13b9440fb93c8167e6cc Mon Sep 17 00:00:00 2001 From: nijtmans Date: Fri, 14 Nov 2008 00:22:39 +0000 Subject: Fixed [Bug 2269431]: load of shared objects leaves emporary files on windows --- ChangeLog | 8 ++++++++ generic/tclIOUtil.c | 16 +++++----------- generic/tclInt.h | 5 +++-- generic/tclLoad.c | 8 +++++--- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b52dff..6a1f276 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-11-13 Jan Nijtmans + + * generic/tclInt.h: rename static function FSUnloadTempFile to + * generic/tclIOUtil.c TclFSUnloadTempFile, needed in tclLoad.c + + * generic/tclLoad.c Fixed [Bug 2269431]: load of shared + objects leaves temporary files on windows + 2008-11-10 Andreas Kupries * doc/platform_shell.n: Fixed [Bug 2255235], reported by Ulrich diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 745ba6b..396acd7 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.151 2008/02/27 03:35:49 jenglish Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.151.2.1 2008/11/14 00:22:39 nijtmans Exp $ */ #include "tclInt.h" @@ -436,12 +436,6 @@ TCL_DECLARE_MUTEX(cwdMutex) Tcl_ThreadDataKey tclFsDataKey; /* - * Declare fallback support function and information for Tcl_FSLoadFile - */ - -static Tcl_FSUnloadFileProc FSUnloadTempFile; - -/* * One of these structures is used each time we successfully load a file from * a file system by way of making a temporary copy of the file on the native * filesystem. We need to store both the actual unloadProc/clientData @@ -3381,7 +3375,7 @@ TclLoadFile( copyToPtr = NULL; (*handlePtr) = newLoadHandle; (*clientDataPtr) = (ClientData) tvdlPtr; - (*unloadProcPtr) = &FSUnloadTempFile; + (*unloadProcPtr) = TclFSUnloadTempFile; Tcl_ResetResult(interp); return retVal; @@ -3445,7 +3439,7 @@ TclpLoadFile( /* *--------------------------------------------------------------------------- * - * FSUnloadTempFile -- + * TclFSUnloadTempFile -- * * This function is called when we loaded a library of code via an * intermediate temporary file. This function ensures the library is @@ -3461,8 +3455,8 @@ TclpLoadFile( *--------------------------------------------------------------------------- */ -static void -FSUnloadTempFile( +void +TclFSUnloadTempFile( Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to * Tcl_FSLoadFile(). The loadHandle is a token * that represents the loaded file. */ diff --git a/generic/tclInt.h b/generic/tclInt.h index f90b629..aef7a3f 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -13,7 +13,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.362.2.4 2008/09/17 18:14:39 dgp Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.362.2.5 2008/11/14 00:22:39 nijtmans Exp $ */ #ifndef _TCLINT @@ -2524,6 +2524,7 @@ MODULE_SCOPE double TclFloor(mp_int *a); MODULE_SCOPE void TclFormatNaN(double value, char *buffer); MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr, const char *attributeName, int *indexPtr); +MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle); MODULE_SCOPE int * TclGetAsyncReadyPtr(void); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp); MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp, @@ -3888,7 +3889,7 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, #include "tclTomMathDecls.h" #endif /* _TCLINT */ - + /* * Local Variables: * mode: c diff --git a/generic/tclLoad.c b/generic/tclLoad.c index 89e003c..90fe79c 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.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: tclLoad.c,v 1.16.4.1 2008/10/07 20:51:46 nijtmans Exp $ + * RCS: @(#) $Id: tclLoad.c,v 1.16.4.2 2008/11/14 00:22:39 nijtmans Exp $ */ #include "tclInt.h" @@ -795,7 +795,7 @@ Tcl_UnloadObjCmd( if (unLoadProcPtr != NULL) { Tcl_MutexLock(&packageMutex); - if (pkgPtr->unloadProc != NULL) { + if ((pkgPtr->unloadProc != NULL) || (unLoadProcPtr == TclFSUnloadTempFile)) { (*unLoadProcPtr)(pkgPtr->loadHandle); } @@ -1154,7 +1154,9 @@ TclFinalizeLoad(void) if (pkgPtr->fileName[0] != '\0') { Tcl_FSUnloadFileProc *unLoadProcPtr = pkgPtr->unLoadProcPtr; - if ((unLoadProcPtr != NULL) && (pkgPtr->unloadProc != NULL)) { + if ((unLoadProcPtr != NULL) + && ((pkgPtr->unloadProc != NULL) + || (unLoadProcPtr == TclFSUnloadTempFile))) { (*unLoadProcPtr)(pkgPtr->loadHandle); } } -- cgit v0.12