From 2a0db87764a4b70fd8dff0002bd2cdf63a4751a5 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 1 Jun 2006 17:19:29 +0000 Subject: * generic/tkConsole.c: Added Tcl_RegisterChannel() calls to bump the refcount of channels passed to Tcl_SetStdChannel(). This prevents early free-ing of the channels that leads to crashes. [Bug 912571]. --- ChangeLog | 6 ++++++ generic/tkConsole.c | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d003455..67b05fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-06-01 Don Porter + + * generic/tkConsole.c: Added Tcl_RegisterChannel() calls to bump + the refcount of channels passed to Tcl_SetStdChannel(). This prevents + early free-ing of the channels that leads to crashes. [Bug 912571]. + 2006-05-29 Jeff Hobbs * win/tkWinEmbed.c (TkpGetOtherWindow): [Bug 1212056] do not panic diff --git a/generic/tkConsole.c b/generic/tkConsole.c index e9b406c..178ba2d 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.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: tkConsole.c,v 1.29 2006/03/21 03:01:27 dgp Exp $ + * RCS: @(#) $Id: tkConsole.c,v 1.30 2006/06/01 17:19:30 dgp Exp $ */ #include "tk.h" @@ -68,7 +68,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp, static Tcl_ChannelType consoleChannelType = { "console", /* Type name. */ - NULL, /* Always non-blocking.*/ + TCL_CHANNEL_VERSION_4, /* v4 channel */ ConsoleClose, /* Close proc. */ ConsoleInput, /* Input proc. */ ConsoleOutput, /* Output proc. */ @@ -77,6 +77,12 @@ static Tcl_ChannelType consoleChannelType = { NULL, /* Get option proc. */ ConsoleWatch, /* Watch for events on console. */ ConsoleHandle, /* Get a handle from the device. */ + NULL, /* close2proc. */ + NULL, /* Always non-blocking.*/ + NULL, /* flush proc. */ + NULL, /* handler proc. */ + NULL, /* wide seek proc */ + NULL, /* thread action proc */ }; #ifdef __WIN32__ @@ -276,6 +282,7 @@ Tk_InitConsoleChannels( "-encoding", "utf-8"); } Tcl_SetStdChannel(consoleChannel, TCL_STDIN); + Tcl_RegisterChannel(NULL, consoleChannel); } if (doOut) { @@ -294,6 +301,7 @@ Tk_InitConsoleChannels( "-encoding", "utf-8"); } Tcl_SetStdChannel(consoleChannel, TCL_STDOUT); + Tcl_RegisterChannel(NULL, consoleChannel); } if (doErr) { @@ -312,6 +320,7 @@ Tk_InitConsoleChannels( "-encoding", "utf-8"); } Tcl_SetStdChannel(consoleChannel, TCL_STDERR); + Tcl_RegisterChannel(NULL, consoleChannel); } } -- cgit v0.12