diff options
author | welch <welch@noemail.net> | 1998-06-27 18:09:53 (GMT) |
---|---|---|
committer | welch <welch@noemail.net> | 1998-06-27 18:09:53 (GMT) |
commit | bad23c30f183e85acf85ab5c18da435fbf5c8fc2 (patch) | |
tree | 1215c0959e90294b37bd360985895f49e8cbea9f /generic/tclIOCmd.c | |
parent | c95abd5e8369461af64d0bdd12781fd7edd702af (diff) | |
download | tcl-bad23c30f183e85acf85ab5c18da435fbf5c8fc2.zip tcl-bad23c30f183e85acf85ab5c18da435fbf5c8fc2.tar.gz tcl-bad23c30f183e85acf85ab5c18da435fbf5c8fc2.tar.bz2 |
plugin updates
FossilOrigin-Name: 594ce53543ab0e1e09fe7eabec3e198a06256812
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 { |