From: Vince Darley Date: Thu, 9 Aug 2001 11:20:28 +0000 (+0000) Subject: Fix for open channels X-Git-Tag: vfs-1-2~137 X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=9e8f28aa4fa1151a2b88899630fb995dd83bd024;p=tclvfs Fix for open channels --- diff --git a/generic/vfs.c b/generic/vfs.c index b1e6ba5..c0a9380 100644 --- a/generic/vfs.c +++ b/generic/vfs.c @@ -657,14 +657,13 @@ VfsOpenFileChannel(cmdInterp, pathPtr, modeString, permissions) channelRet = (VfsChannelCleanupInfo*) ckalloc(sizeof(VfsChannelCleanupInfo)); channelRet->channel = theChannel; + channelRet->interp = interp; if (reslen == 2) { Tcl_ListObjIndex(interp, resultObj, 1, &element); channelRet->closeCallback = element; Tcl_IncrRefCount(channelRet->closeCallback); - channelRet->interp = interp; } else { channelRet->closeCallback = NULL; - channelRet->interp = NULL; } } } @@ -687,8 +686,9 @@ VfsOpenFileChannel(cmdInterp, pathPtr, modeString, permissions) * anyone. We use Tcl_DetachChannel to do this for us. */ chan = channelRet->channel; - /* We must use the correct interpreter, not our own 'vfs' interpreter */ - Tcl_DetachChannel(channelRet->interp, chan); + /* We must use the correct interpreter */ + Tcl_DetachChannel(interp, chan); + if (channelRet->closeCallback != NULL) { Tcl_CreateCloseHandler(chan, &VfsCloseProc, (ClientData)channelRet); /* The channelRet structure will be freed in the callback */