summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorchengyemao <chengyemao@noemail.net>2003-09-20 03:43:29 (GMT)
committerchengyemao <chengyemao@noemail.net>2003-09-20 03:43:29 (GMT)
commitf1d548d376b071fb9b5f27dfe5adea5a9314313c (patch)
tree447c81f8328e5de72f1e6350e5e14625f479f490 /generic
parent0aea6e833b282fe496f81f63040127ba09f819a8 (diff)
downloadtk-f1d548d376b071fb9b5f27dfe5adea5a9314313c.zip
tk-f1d548d376b071fb9b5f27dfe5adea5a9314313c.tar.gz
tk-f1d548d376b071fb9b5f27dfe5adea5a9314313c.tar.bz2
Fixed memory leak (bug 802435)
FossilOrigin-Name: cbe581a3ce5ff0e4ddf7922888b0895b839d9767
Diffstat (limited to 'generic')
-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);
+ }
}
}