summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-06-01 18:21:41 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-06-01 18:21:41 (GMT)
commit8e448f145ef751d9ab30ca9d8d384c14263c1199 (patch)
tree1d2478343c8b3d38fb2d323c39b1ec1a160236b9
parent843f3e406c6e4cfad692db418c39912f538e25d6 (diff)
downloadtk-8e448f145ef751d9ab30ca9d8d384c14263c1199.zip
tk-8e448f145ef751d9ab30ca9d8d384c14263c1199.tar.gz
tk-8e448f145ef751d9ab30ca9d8d384c14263c1199.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].
-rw-r--r--ChangeLog6
-rw-r--r--generic/tkConsole.c13
2 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a459f0..1967726 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-01 Don Porter <dgp@users.sourceforge.net>
+
+ * 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 <jeffh@ActiveState.com>
* tests/entry.test (entry-22.1):
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 5233749..1aaf2c9 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.18.2.2 2005/06/23 22:07:13 das Exp $
+ * RCS: @(#) $Id: tkConsole.c,v 1.18.2.3 2006/06/01 18:21:41 dgp Exp $
*/
#include "tk.h"
@@ -81,7 +81,7 @@ static int ConsoleHandle _ANSI_ARGS_((ClientData instanceData,
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. */
@@ -90,6 +90,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 */
};
@@ -273,6 +279,7 @@ Tk_InitConsoleChannels(interp)
"-encoding", "utf-8");
}
Tcl_SetStdChannel(consoleChannel, TCL_STDIN);
+ Tcl_RegisterChannel(NULL, consoleChannel);
}
/*
@@ -291,6 +298,7 @@ Tk_InitConsoleChannels(interp)
"-encoding", "utf-8");
}
Tcl_SetStdChannel(consoleChannel, TCL_STDOUT);
+ Tcl_RegisterChannel(NULL, consoleChannel);
}
/*
@@ -309,6 +317,7 @@ Tk_InitConsoleChannels(interp)
"-encoding", "utf-8");
}
Tcl_SetStdChannel(consoleChannel, TCL_STDERR);
+ Tcl_RegisterChannel(NULL, consoleChannel);
}
}
Tcl_MutexUnlock(&consoleMutex);