summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-06-01 17:19:29 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-06-01 17:19:29 (GMT)
commit2a0db87764a4b70fd8dff0002bd2cdf63a4751a5 (patch)
treec7bdf54677d410b36e05e2825588395efa068dc5 /generic
parentde94051cc9cefddb0cfae707598416939eabe5b8 (diff)
downloadtk-2a0db87764a4b70fd8dff0002bd2cdf63a4751a5.zip
tk-2a0db87764a4b70fd8dff0002bd2cdf63a4751a5.tar.gz
tk-2a0db87764a4b70fd8dff0002bd2cdf63a4751a5.tar.bz2
* 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].
Diffstat (limited to 'generic')
-rw-r--r--generic/tkConsole.c13
1 files changed, 11 insertions, 2 deletions
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);
}
}