summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdejong <mdejong>2002-06-15 21:06:07 (GMT)
committermdejong <mdejong>2002-06-15 21:06:07 (GMT)
commitdf16beef2394e43a851c02727b1544950cebee65 (patch)
tree5938553c12d20382fde16b9754ecd66b73b2ee85
parent92c2dddc8dde11c773828d152e0e49ef9c920be9 (diff)
downloadtk-df16beef2394e43a851c02727b1544950cebee65.zip
tk-df16beef2394e43a851c02727b1544950cebee65.tar.gz
tk-df16beef2394e43a851c02727b1544950cebee65.tar.bz2
* generic/tkWindow.c (Tk_DestroyWindow): Set the pathName
component of a window to NULL after its memory has been deallocated to avoid a possible illegal memory access as a result of a call to Tk_PathName() on a Tk_Window structure of a window that has already been destroyed. [Tk bug 521946]
-rw-r--r--ChangeLog9
-rw-r--r--generic/tkWindow.c9
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a6ba6e2..c88e100 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2002-06-14 Mo DeJong <mdejong@users.sourceforge.net>
+ * generic/tkWindow.c (Tk_DestroyWindow): Set the pathName
+ component of a window to NULL after its memory has been
+ deallocated to avoid a possible illegal memory access
+ as a result of a call to Tk_PathName() on a Tk_Window
+ structure of a window that has already been destroyed.
+ [Tk bug 521946]
+
+2002-06-14 Mo DeJong <mdejong@users.sourceforge.net>
+
* generic/tkOption.c (Tk_GetOption): Allocate
memory with ckalloc not malloc. This keeps
Tk from erroring out when built with
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 6bee9fa..03addc0 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWindow.c,v 1.47 2002/06/15 00:21:42 hobbs Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.48 2002/06/15 21:06:07 mdejong Exp $
*/
#include "tkPort.h"
@@ -1401,6 +1401,13 @@ Tk_DestroyWindow(tkwin)
(ClientData) winPtr->pathName);
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&winPtr->mainPtr->nameTable,
winPtr->pathName));
+ /*
+ * The memory pointed to by pathName has been deallocated.
+ * Keep users from accessing it after the window has been
+ * destroyed by setting it to NULL.
+ */
+ winPtr->pathName = NULL;
+
/*
* Invalidate all objects referring to windows on this display.
*/