summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchengyemao <chengyemao>2003-09-20 03:43:29 (GMT)
committerchengyemao <chengyemao>2003-09-20 03:43:29 (GMT)
commit9b8224f61793a03c3538d83eaeb6051095b9e35b (patch)
tree447c81f8328e5de72f1e6350e5e14625f479f490
parentbeb29e5c7ae3651d6200e32b1da5b0670f547aea (diff)
downloadtk-9b8224f61793a03c3538d83eaeb6051095b9e35b.zip
tk-9b8224f61793a03c3538d83eaeb6051095b9e35b.tar.gz
tk-9b8224f61793a03c3538d83eaeb6051095b9e35b.tar.bz2
Fixed memory leak (bug 802435)
-rw-r--r--generic/tkConsole.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index c8e2c8a..17161cf 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 2002/08/05 04:30:38 dgp Exp $
+ * RCS: @(#) $Id: tkConsole.c,v 1.19 2003/09/20 03:43:29 chengyemao Exp $
*/
#include "tk.h"
@@ -726,13 +726,10 @@ ConsoleEventProc(clientData, eventPtr)
{
ConsoleInfo *info = (ConsoleInfo *) clientData;
Tcl_Interp *consoleInterp;
- Tcl_DString dString;
if (eventPtr->type == DestroyNotify) {
- Tcl_DStringInit(&dString);
-
- consoleInterp = info->consoleInterp;
+ consoleInterp = info->consoleInterp;
/*
* It is possible that the console interpreter itself has
@@ -743,12 +740,15 @@ ConsoleEventProc(clientData, eventPtr)
if (consoleInterp == (Tcl_Interp *) NULL) {
return;
- }
- Tcl_Preserve((ClientData) consoleInterp);
- Tcl_DStringAppend(&dString, "::tk::ConsoleExit", -1);
- Tcl_Eval(consoleInterp, Tcl_DStringValue(&dString));
- Tcl_DStringFree(&dString);
- Tcl_Release((ClientData) consoleInterp);
+ } else {
+ Tcl_DString dString;
+ Tcl_DStringInit(&dString);
+ Tcl_Preserve((ClientData) consoleInterp);
+ Tcl_DStringAppend(&dString, "::tk::ConsoleExit", -1);
+ Tcl_Eval(consoleInterp, Tcl_DStringValue(&dString));
+ Tcl_DStringFree(&dString);
+ Tcl_Release((ClientData) consoleInterp);
+ }
}
}