summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--generic/tkConsole.c17
2 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7535eee..1760ae9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-06-26 Joe Mistachkin <joe@mistachkin.com>
+
+ * generic/tkConsole.c (ConsoleDeleteProc): Set tsdPtr->gStdoutInterp
+ to NULL when the console command is deleted [Bug 756840]. Also,
+ added Tcl_Preserve/Tcl_Release for consoleInterp in InterpreterCmd
+ in case it gets deleted during the calls to Tcl_GlobalEval and
+ Tcl_RecordAndEval.
+
2004-06-24 Donal K. Fellows <donal.k.fellows@man.ac.uk>
* tests/canvPs.test, etc: Use standard tcltest constraint names.
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 0c05fe5..eebac0e 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.20 2004/03/17 18:15:43 das Exp $
+ * RCS: @(#) $Id: tkConsole.c,v 1.21 2004/06/26 09:04:15 mistachkin Exp $
*/
#include "tk.h"
@@ -639,6 +639,7 @@ InterpreterCmd(clientData, interp, argc, argv)
char c;
size_t length;
int result;
+ Tcl_Interp *consoleInterp;
Tcl_Interp *otherInterp;
if (argc < 2) {
@@ -649,6 +650,8 @@ InterpreterCmd(clientData, interp, argc, argv)
c = argv[1][0];
length = strlen(argv[1]);
+ consoleInterp = info->consoleInterp;
+ Tcl_Preserve((ClientData) consoleInterp);
otherInterp = info->interp;
Tcl_Preserve((ClientData) otherInterp);
if ((c == 'e') && (strncmp(argv[1], "eval", length)) == 0) {
@@ -666,6 +669,7 @@ InterpreterCmd(clientData, interp, argc, argv)
result = TCL_ERROR;
}
Tcl_Release((ClientData) otherInterp);
+ Tcl_Release((ClientData) consoleInterp);
return result;
}
@@ -691,6 +695,17 @@ ConsoleDeleteProc(clientData)
ClientData clientData;
{
ConsoleInfo *info = (ConsoleInfo *) clientData;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ /*
+ * Also need to null this out to prevent any further use.
+ *
+ * Fix [Bug #756840]
+ */
+ if (tsdPtr != NULL) {
+ tsdPtr->gStdoutInterp = NULL;
+ }
Tcl_DeleteInterp(info->consoleInterp);
info->consoleInterp = NULL;