diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-05-13 17:47:41 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-05-13 17:47:41 (GMT) |
commit | ad6b4e6f8f42865b6b42bbd9b615b683aee9da6a (patch) | |
tree | a3e5e956a80ba6b371c0582dc93c5e53eaa82a67 /generic/tclZipfs.c | |
parent | 737753205d0da04de457fb36afb75cb90b133bbe (diff) | |
download | tcl-ad6b4e6f8f42865b6b42bbd9b615b683aee9da6a.zip tcl-ad6b4e6f8f42865b6b42bbd9b615b683aee9da6a.tar.gz tcl-ad6b4e6f8f42865b6b42bbd9b615b683aee9da6a.tar.bz2 |
Backout [217391dc7f] and [b05e314d7a]. For the reason, see: [https://github.com/tcltk/tcl/runs/2573477656?check_suite_focus=true]: Test file error: alloc: invalid block: 0x558a6e095990: 20 6e
Diffstat (limited to 'generic/tclZipfs.c')
-rw-r--r-- | generic/tclZipfs.c | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index bad4cb9..8706d5a 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -249,7 +249,7 @@ typedef struct ZipChannel { * Most are kept in single ZipFS struct. When build with threading support * this struct is protected by the ZipFSMutex (see below). * - * The "fileHash" component is the process-wide global table of all known ZIP + * The "fileHash" component is the process wide global table of all known ZIP * archive members in all mounted ZIP archives. * * The "zipHash" components is the process wide global table of all mounted @@ -346,9 +346,7 @@ static int ZipFSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, static int ZipMapArchive(Tcl_Interp *interp, ZipFile *zf, void *handle); static void ZipfsExitHandler(ClientData clientData); -static void ZipfsMountExitHandler(ClientData clientData); static void ZipfsSetup(void); -static void ZipfsFinalize(void); static int ZipChannelClose(void *instanceData, Tcl_Interp *interp, int flags); static Tcl_DriverGetHandleProc ZipChannelGetFile; @@ -1615,7 +1613,7 @@ ZipFSCatalogFilesystem( */ zf->mountPoint = (char *) Tcl_GetHashKey(&ZipFS.zipHash, hPtr); - Tcl_CreateExitHandler(ZipfsMountExitHandler, zf); + Tcl_CreateExitHandler(ZipfsExitHandler, zf); zf->mountPointLen = strlen(zf->mountPoint); zf->nameLength = strlen(zipname); @@ -1857,7 +1855,6 @@ ZipfsSetup(void) strcpy(ZipFS.fallbackEntryEncoding, ZIPFS_FALLBACK_ENCODING); ZipFS.utf8 = Tcl_GetEncoding(NULL, "utf-8"); ZipFS.initialized = 1; - Tcl_CreateExitHandler(ZipfsExitHandler, NULL); } /* @@ -2181,7 +2178,7 @@ TclZipfs_Unmount( ckfree(z); } ZipFSCloseArchive(interp, zf); - Tcl_DeleteExitHandler(ZipfsMountExitHandler, zf); + Tcl_DeleteExitHandler(ZipfsExitHandler, zf); ckfree(zf); unmounted = 1; @@ -5735,45 +5732,11 @@ static void ZipfsExitHandler( ClientData clientData) { - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - if (ZipFS.initialized != -1) { - hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - if (hPtr == NULL) { - ZipfsFinalize(); - } else { - /* ZipFS.fallbackEntryEncoding was already freed by - * ZipfsMountExitHandler - */ - } - } -} - -static void -ZipfsFinalize(void) { - Tcl_DeleteHashTable(&ZipFS.fileHash); - ckfree(ZipFS.fallbackEntryEncoding); - ZipFS.initialized = -1; -} - -static void -ZipfsMountExitHandler( - ClientData clientData) -{ - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - ZipFile *zf = (ZipFile *) clientData; if (TCL_OK != TclZipfs_Unmount(NULL, zf->mountPoint)) { Tcl_Panic("tried to unmount busy filesystem"); } - - hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - if (hPtr == NULL) { - ZipfsFinalize(); - } - } /* |