diff options
author | welch <welch> | 1998-06-27 18:09:53 (GMT) |
---|---|---|
committer | welch <welch> | 1998-06-27 18:09:53 (GMT) |
commit | e49b28cf440752d763d488c4673d081883e93033 (patch) | |
tree | 1215c0959e90294b37bd360985895f49e8cbea9f /generic/tclIOCmd.c | |
parent | 32e60ee1bab18f9b5441eeb97eadcf604af608ef (diff) | |
download | tcl-e49b28cf440752d763d488c4673d081883e93033.zip tcl-e49b28cf440752d763d488c4673d081883e93033.tar.gz tcl-e49b28cf440752d763d488c4673d081883e93033.tar.bz2 |
plugin updates
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r-- | generic/tclIOCmd.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 5640b47..88a299a 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1238,12 +1238,28 @@ AcceptCallbackProc(callbackData, chan, address, port) TclFormatInt(portBuf, port); Tcl_RegisterChannel(interp, chan); + + /* + * Artificially bump the refcount to protect the channel from + * being deleted while the script is being evaluated. + */ + + Tcl_RegisterChannel((Tcl_Interp *) NULL, chan); + result = Tcl_VarEval(interp, script, " ", Tcl_GetChannelName(chan), " ", address, " ", portBuf, (char *) NULL); if (result != TCL_OK) { Tcl_BackgroundError(interp); Tcl_UnregisterChannel(interp, chan); } + + /* + * Decrement the artificially bumped refcount. After this it is + * not safe anymore to use "chan", because it may now be deleted. + */ + + Tcl_UnregisterChannel((Tcl_Interp *) NULL, chan); + Tcl_Release((ClientData) interp); Tcl_Release((ClientData) script); } else { |