summaryrefslogtreecommitdiffstats
path: root/generic/tclIOGT.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-05-06 14:43:19 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-05-06 14:43:19 (GMT)
commit5684837e350796f98813f2dc9cfecabb7ea2fe09 (patch)
treed357243898e1785fc60d1870f031abb95432f31f /generic/tclIOGT.c
parentd9f128a5af6973fa48e8c0a801ca19c34cb67784 (diff)
parent0fc3bdcc7e6bd2903a1e84017073bf39dff8a3ad (diff)
downloadtcl-5684837e350796f98813f2dc9cfecabb7ea2fe09.zip
tcl-5684837e350796f98813f2dc9cfecabb7ea2fe09.tar.gz
tcl-5684837e350796f98813f2dc9cfecabb7ea2fe09.tar.bz2
Merge 8.5. New test iogt-2.5 panics.
Diffstat (limited to 'generic/tclIOGT.c')
-rw-r--r--generic/tclIOGT.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c
index 29996ea..6cc33eb 100644
--- a/generic/tclIOGT.c
+++ b/generic/tclIOGT.c
@@ -298,7 +298,6 @@ TclChannelTransform(
}
Tcl_DStringFree(&ds);
- dataPtr->self = chan;
dataPtr->watchMask = 0;
dataPtr->mode = mode;
dataPtr->timer = NULL;
@@ -317,6 +316,7 @@ TclChannelTransform(
ReleaseData(dataPtr);
return TCL_ERROR;
}
+ Tcl_Preserve(dataPtr->self);
/*
* At last initialize the transformation at the script level.
@@ -437,6 +437,9 @@ ExecuteCallback(
break;
case TRANSMIT_DOWN:
+ if (dataPtr->self == NULL) {
+ break;
+ }
resObj = Tcl_GetObjResult(eval);
resBuf = Tcl_GetByteArrayFromObj(resObj, &resLen);
Tcl_WriteRaw(Tcl_GetStackedChannel(dataPtr->self), (char *) resBuf,
@@ -444,6 +447,9 @@ ExecuteCallback(
break;
case TRANSMIT_SELF:
+ if (dataPtr->self == NULL) {
+ break;
+ }
resObj = Tcl_GetObjResult(eval);
resBuf = Tcl_GetByteArrayFromObj(resObj, &resLen);
Tcl_WriteRaw(dataPtr->self, (char *) resBuf, resLen);
@@ -579,6 +585,8 @@ TransformCloseProc(
* General cleanup.
*/
+ Tcl_Release(dataPtr->self);
+ dataPtr->self = NULL;
ReleaseData(dataPtr);
return TCL_OK;
}
@@ -614,7 +622,7 @@ TransformInputProc(
* Should assert(dataPtr->mode & TCL_READABLE);
*/
- if (toRead == 0) {
+ if (toRead == 0 || dataPtr->self == NULL) {
/*
* Catch a no-op.
*/
@@ -1084,6 +1092,9 @@ TransformWatchProc(
* unchanged.
*/
+ if (dataPtr->self == NULL) {
+ return;
+ }
downChan = Tcl_GetStackedChannel(dataPtr->self);
Tcl_GetChannelType(downChan)->watchProc(