diff options
author | Joe Mistachkin <joe@mistachkin.com> | 2004-06-26 09:04:13 (GMT) |
---|---|---|
committer | Joe Mistachkin <joe@mistachkin.com> | 2004-06-26 09:04:13 (GMT) |
commit | 62db82987c41af18ad0badb76107d4bab0bb1b6e (patch) | |
tree | cfe11c213050876f72fa09e76a870cd98e5c9be7 | |
parent | 4108c25be244c15e88d8d4f81ed9d0b08f148d0d (diff) | |
download | tk-62db82987c41af18ad0badb76107d4bab0bb1b6e.zip tk-62db82987c41af18ad0badb76107d4bab0bb1b6e.tar.gz tk-62db82987c41af18ad0badb76107d4bab0bb1b6e.tar.bz2 |
Fix for [Bug 756840]
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/tkConsole.c | 17 |
2 files changed, 24 insertions, 1 deletions
@@ -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; |