diff options
author | dgp <dgp@users.sourceforge.net> | 2014-05-08 03:13:01 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-05-08 03:13:01 (GMT) |
commit | 5e1038193c820c5a5ae7b27886d8d3100e18ea49 (patch) | |
tree | 4ea14c9afded968db298090885f66be13ab1c5be /generic/tclIORChan.c | |
parent | b622ae7f2419b531a196cd2fe0ac570f195bf030 (diff) | |
parent | 48ae7e42c1bd6a104c78d737fd6b826a1a4ee7bd (diff) | |
download | tcl-5e1038193c820c5a5ae7b27886d8d3100e18ea49.zip tcl-5e1038193c820c5a5ae7b27886d8d3100e18ea49.tar.gz tcl-5e1038193c820c5a5ae7b27886d8d3100e18ea49.tar.bz2 |
Merge 8.5.
Diffstat (limited to 'generic/tclIORChan.c')
-rw-r--r-- | generic/tclIORChan.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 94428bb..12fa4a0 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -1111,6 +1111,7 @@ ReflectClose( ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in * this interp */ Tcl_HashEntry *hPtr; /* Entry in the above map */ + Tcl_ChannelType *tctPtr; if (TclInThreadExit()) { /* @@ -1149,6 +1150,11 @@ ReflectClose( } #endif + tctPtr = ((Channel *)rcPtr->chan)->typePtr; + if (tctPtr && tctPtr != &tclRChannelType) { + ckfree((char *)tctPtr); + ((Channel *)rcPtr->chan)->typePtr = NULL; + } Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); return EOK; } @@ -1213,6 +1219,11 @@ ReflectClose( } #endif + tctPtr = ((Channel *)rcPtr->chan)->typePtr; + if (tctPtr && tctPtr != &tclRChannelType) { + ckfree((char *)tctPtr); + ((Channel *)rcPtr->chan)->typePtr = NULL; + } Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); #ifdef TCL_THREADS } @@ -2170,14 +2181,6 @@ FreeReflectedChannel( { Channel *chanPtr = (Channel *) rcPtr->chan; - if (chanPtr->typePtr != &tclRChannelType) { - /* - * Delete a cloned ChannelType structure. - */ - - ckfree(chanPtr->typePtr); - chanPtr->typePtr = NULL; - } Tcl_Release(chanPtr); Tcl_DecrRefCount(rcPtr->name); Tcl_DecrRefCount(rcPtr->methods); @@ -2873,11 +2876,13 @@ ForwardProc( * call upon for the driver. */ - case ForwardedClose: + case ForwardedClose: { /* * No parameters/results. */ + Tcl_ChannelType *tctPtr; + if (InvokeTclMethod(rcPtr, METH_FINAL, NULL, NULL, &resObj)!=TCL_OK) { ForwardSetObjError(paramPtr, resObj); } @@ -2902,8 +2907,14 @@ ForwardProc( Tcl_GetChannelName(rcPtr->chan)); Tcl_DeleteHashEntry(hPtr); - Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); + tctPtr = ((Channel *)rcPtr->chan)->typePtr; + if (tctPtr && tctPtr != &tclRChannelType) { + ckfree((char *)tctPtr); + ((Channel *)rcPtr->chan)->typePtr = NULL; + } + Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); break; + } case ForwardedInput: { Tcl_Obj *toReadObj = Tcl_NewIntObj(paramPtr->input.toRead); |