summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authorwelch <welch>1998-06-27 18:09:53 (GMT)
committerwelch <welch>1998-06-27 18:09:53 (GMT)
commite49b28cf440752d763d488c4673d081883e93033 (patch)
tree1215c0959e90294b37bd360985895f49e8cbea9f /generic/tclIO.c
parent32e60ee1bab18f9b5441eeb97eadcf604af608ef (diff)
downloadtcl-e49b28cf440752d763d488c4673d081883e93033.zip
tcl-e49b28cf440752d763d488c4673d081883e93033.tar.gz
tcl-e49b28cf440752d763d488c4673d081883e93033.tar.bz2
plugin updates
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 534060b..f198474 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.
*
- * SCCS: %Z% $Id: tclIO.c,v 1.2 1998/06/09 13:08:16 stanton Exp $
+ * SCCS: %Z% $Id: tclIO.c,v 1.3 1998/06/27 18:10:15 welch Exp $
*/
#include "tclInt.h"
@@ -4519,7 +4519,14 @@ Tcl_NotifyChannel(channel, mask)
ChannelHandler *chPtr;
NextChannelHandler nh;
- Tcl_Preserve((ClientData)chanPtr);
+ /*
+ * 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.
+ */
+
+ Tcl_RegisterChannel((Tcl_Interp *) NULL, channel);
/*
* If we are flushing in the background, be sure to call FlushChannel
@@ -4566,7 +4573,13 @@ Tcl_NotifyChannel(channel, mask)
if (chanPtr->typePtr != NULL) {
UpdateInterest(chanPtr);
}
- Tcl_Release((ClientData)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);
nestedHandlerPtr = nh.nestedHandlerPtr;
}