diff options
author | welch <welch@noemail.net> | 1998-10-30 00:38:27 (GMT) |
---|---|---|
committer | welch <welch@noemail.net> | 1998-10-30 00:38:27 (GMT) |
commit | 476385e62af42439407392ba70b0fb2367a5484c (patch) | |
tree | f812290afe768219222e9256236b5169d9ba5820 /generic/tclIO.c | |
parent | ae133bdf0172444dfef5fcaea80bb3e0613189b7 (diff) | |
download | tcl-476385e62af42439407392ba70b0fb2367a5484c.zip tcl-476385e62af42439407392ba70b0fb2367a5484c.tar.gz tcl-476385e62af42439407392ba70b0fb2367a5484c.tar.bz2 |
Fixed the Tcl_NotifyChannel bug, plus added a test case for it.
Simply replaced Tcl_RegisterChannel/UnregisterChannel with
Tcl_Preserve/Tcl_Release was all it took. Chanels are already
"eventually freed"
FossilOrigin-Name: b31fdd817b4057d1a9e978490f5ea1ed41c2ab9e
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 6de1151..9725902 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.4 1998/09/14 18:39:59 stanton Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.5 1998/10/30 00:38:38 welch Exp $ */ #include "tclInt.h" @@ -4520,13 +4520,10 @@ Tcl_NotifyChannel(channel, mask) NextChannelHandler nh; /* - * Prevent the event handler from deleting the channel by incrementing - * the channel's ref count. Case in point: ChannelEventScriptInvoker() - * was evaling a script (owned by the channel) which caused the channel - * to be closed and then the byte codes no longer existed. + * Preserve the channel struct in case the script closes it. */ - Tcl_RegisterChannel((Tcl_Interp *) NULL, channel); + Tcl_Preserve((ClientData) channel); /* * If we are flushing in the background, be sure to call FlushChannel @@ -4574,12 +4571,7 @@ Tcl_NotifyChannel(channel, mask) UpdateInterest(chanPtr); } - /* - * No longer need to protect the channel from being deleted. - * After this point it is unsafe to use the value of "channel". - */ - - Tcl_UnregisterChannel((Tcl_Interp *) NULL, channel); + Tcl_Release((ClientData) channel); nestedHandlerPtr = nh.nestedHandlerPtr; } |