From 8e711fbc8f9fa92e577821c9c5243bbd4c1d6a8c Mon Sep 17 00:00:00 2001 From: vincentdarley Date: Wed, 4 Dec 2002 13:09:23 +0000 Subject: filesystem cleanup fix, virtual filesystem load fix --- ChangeLog | 12 ++++++++++++ generic/tclEvent.c | 25 +++++++++++++++++-------- generic/tclIOUtil.c | 27 +++++++++++++++------------ generic/tclTestObj.c | 11 +++++++++-- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 545d1b1..7fd238d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-12-04 Vince Darley + + * generic/tclIOUtil.c: fix to redirected 'load' in virtual + filesystem for some Unix systems. + + * generic/tclEvent.c: the filesystem must be cleaned up before + the encoding subsystem because it needs access to encodings. + Fixes crash on exit observed in embedded applications. + + * generic/tclTestObj.c: patch omitted from previous change + of 2002-11-13 + 2002-12-03 Jeff Hobbs * generic/tclStubLib.c (Tcl_InitStubs): prevent the cached check of diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 957c5f6..28b3489 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.24 2002/11/07 02:13:36 mdejong Exp $ + * RCS: @(#) $Id: tclEvent.c,v 1.25 2002/12/04 13:09:23 vincentdarley Exp $ */ #include "tclInt.h" @@ -812,6 +812,22 @@ Tcl_Finalize() TclFinalizeCompExecEnv(); TclFinalizeEnvironment(); + /* + * Finalizing the filesystem must come after anything which + * might conceivably interact with the 'Tcl_FS' API. This + * will also unload any extensions which have been loaded. + * However, it also needs access to the encoding subsystem + * during finalization, so that system must still be intact + * at this point. + */ + TclFinalizeFilesystem(); + + /* + * We must be sure the encoding finalization doesn't need + * to examine the filesystem in any way. Since it only + * needs to clean up internal data structures, this is + * fine. + */ TclFinalizeEncodingSubsystem(); if (tclExecutableName != NULL) { @@ -836,13 +852,6 @@ Tcl_Finalize() TclFinalizeSynchronization(); - /** - * Finalizing the filesystem must come after anything which - * might conceivably interact with the 'Tcl_FS' API. This - * will also unload any extensions which have been loaded. - */ - TclFinalizeFilesystem(); - /* * There shouldn't be any malloc'ed memory after this. */ diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 334c569..059348d 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.65 2002/08/16 13:37:49 dkf Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.66 2002/12/04 13:09:24 vincentdarley Exp $ */ #include "tclInt.h" @@ -2570,23 +2570,26 @@ Tcl_FSLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr, if (TclCrossFilesystemCopy(interp, pathPtr, copyToPtr) == TCL_OK) { + Tcl_LoadHandle newLoadHandle = NULL; + Tcl_FSUnloadFileProc *newUnloadProcPtr = NULL; + FsDivertLoad *tvdlPtr; + int retVal; + +#if !defined(__WIN32__) && !defined(MAC_TCL) /* * Do we need to set appropriate permissions * on the file? This may be required on some * systems. On Unix we could loop over * the file attributes, and set any that are - * called "-permissions" to 0777. Or directly: - * - * Tcl_Obj* perm = Tcl_NewStringObj("0777",-1); - * Tcl_IncrRefCount(perm); - * Tcl_FSFileAttrsSet(NULL, 2, copyToPtr, perm); - * Tcl_DecrRefCount(perm); - * + * called "-permissions" to 0700. However, + * we just do this directly, like this: */ - Tcl_LoadHandle newLoadHandle = NULL; - Tcl_FSUnloadFileProc *newUnloadProcPtr = NULL; - FsDivertLoad *tvdlPtr; - int retVal; + + Tcl_Obj* perm = Tcl_NewStringObj("0700",-1); + Tcl_IncrRefCount(perm); + Tcl_FSFileAttrsSet(NULL, 2, copyToPtr, perm); + Tcl_DecrRefCount(perm); +#endif retVal = Tcl_FSLoadFile(interp, copyToPtr, sym1, sym2, proc1Ptr, proc2Ptr, diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index ec489d6..5c45d70 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.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: tclTestObj.c,v 1.11 2002/02/15 23:42:12 kennykb Exp $ + * RCS: @(#) $Id: tclTestObj.c,v 1.12 2002/12/04 13:09:24 vincentdarley Exp $ */ #include "tclInt.h" @@ -911,7 +911,8 @@ TeststringobjCmd(clientData, interp, objc, objv) TestString *strPtr; static CONST char *options[] = { "append", "appendstrings", "get", "get2", "length", "length2", - "set", "set2", "setlength", "ualloc", (char *) NULL + "set", "set2", "setlength", "ualloc", "getunicode", + (char *) NULL }; if (objc < 3) { @@ -1073,6 +1074,12 @@ TeststringobjCmd(clientData, interp, objc, objv) } Tcl_SetIntObj(Tcl_GetObjResult(interp), length); break; + case 10: /* getunicode */ + if (objc != 3) { + goto wrongNumArgs; + } + Tcl_GetUnicodeFromObj(varPtr[varIndex], NULL); + break; } return TCL_OK; -- cgit v0.12