Skip to content

Commit

Permalink
Merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Oct 9, 2023
2 parents 6056ed5 + a2e046c commit 0cee5a8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 86 deletions.
85 changes: 0 additions & 85 deletions generic/tclIOUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -3609,91 +3609,6 @@ Tcl_FSUnloadFile(
return TCL_OK;
}

/*
*----------------------------------------------------------------------
*
* TclFSUnloadTempFile --
*
* Unloads an object loaded via temporary file from a virtual filesystem
* to a native filesystem.
*
* Results:
* None.
*
* Side effects:
* Frees resources for the loaded object and deletes the temporary file.
*
*----------------------------------------------------------------------
*/

void
TclFSUnloadTempFile(
Tcl_LoadHandle loadHandle) /* A handle for the object, as provided by a
* previous call to Tcl_FSLoadFile(). */
{
FsDivertLoad *tvdlPtr = (FsDivertLoad *) loadHandle;

if (tvdlPtr == NULL) {
/*
* tvdlPtr was provided by Tcl_LoadFile so it should not be NULL here.
*/
return;
}

if (tvdlPtr->unloadProcPtr != NULL) {
/*
* 'unloadProcPtr' must be called first so that the shared library is
* actually unloaded by the OS. Otherwise, the following 'delete' may
* well fail because the shared library is still in use.
*/

tvdlPtr->unloadProcPtr(tvdlPtr->loadHandle);
}

if (tvdlPtr->divertedFilesystem == NULL) {
/*
* Call the function for the native fileystem, which works even at this
* late stage.
*/

TclpDeleteFile(tvdlPtr->divertedFileNativeRep);
NativeFreeInternalRep(tvdlPtr->divertedFileNativeRep);
} else {
/*
* Remove the temporary file that was created. If encodings have
* already been freed because the interpreter is exiting this may
* crash.
*/

if (tvdlPtr->divertedFilesystem->deleteFileProc(tvdlPtr->divertedFile)
!= TCL_OK) {
/*
* This may have happened because Tcl is exiting and encodings may
* have already been deleted, or something else the filesystem
* depends on may be gone.
*
* TO DO: Figure out how to delete this file more robustly, or
* give the filesystem the information it needs to delete the file
* more robustly. One problem might be that the filesystem cannot
* extract the information it needs from the above pathname object
* because Tcl's entire filesystem apparatus (the code in this
* file) has been finalized and there is no way to get the native
* handle of the file.
*/
}

/*
* This also decrements the refCount of the Tcl_Filesystem
* corresponding to this file. which might case filesystem to be freed
* if Tcl is exiting.
*/

Tcl_DecrRefCount(tvdlPtr->divertedFile);
}

Tcl_Free(tvdlPtr);
}

/*
*---------------------------------------------------------------------------
*
Expand Down
1 change: 0 additions & 1 deletion generic/tclInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,6 @@ MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs(Tcl_Interp *interp,
void *clientData, Tcl_CmdDeleteProc *deleteProc);
MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr,
const char *encodingName);
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,
Expand Down

0 comments on commit 0cee5a8

Please sign in to comment.