diff options
author | mdejong <mdejong> | 2002-06-18 01:00:58 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2002-06-18 01:00:58 (GMT) |
commit | 19d2e829a951d2987a02efb7560f6e5145c510ef (patch) | |
tree | f8b3397df20ef5796f42ffc5a72cf39d27e48a7d /generic | |
parent | 9244c6c5d0887b5f57641877727c0bb0400499fd (diff) | |
download | tk-19d2e829a951d2987a02efb7560f6e5145c510ef.zip tk-19d2e829a951d2987a02efb7560f6e5145c510ef.tar.gz tk-19d2e829a951d2987a02efb7560f6e5145c510ef.tar.bz2 |
* generic/tkImage.c (Tk_ImageObjCmd, DeleteImage): Call
Tcl_Preserve and Tcl_Release for the masterPtr->winPtr
window to avoid accessing memory that had already
been deallocated in DeleteImage.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkImage.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/generic/tkImage.c b/generic/tkImage.c index 69b1e19..2a2aef8 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkImage.c,v 1.15 2002/06/14 22:25:12 jenglish Exp $ + * RCS: @(#) $Id: tkImage.c,v 1.16 2002/06/18 01:00:59 mdejong Exp $ */ #include "tkInt.h" @@ -257,6 +257,7 @@ Tk_ImageObjCmd(clientData, interp, objc, objv) masterPtr->instancePtr = NULL; masterPtr->deleted = 0; masterPtr->winPtr = winPtr->mainPtr->winPtr; + Tcl_Preserve((ClientData) masterPtr->winPtr); Tcl_SetHashValue(hPtr, masterPtr); } else { /* @@ -910,6 +911,7 @@ DeleteImage(masterPtr) if ((masterPtr->winPtr->flags & TK_ALREADY_DEAD) == 0) { Tcl_DeleteHashEntry(masterPtr->hPtr); } + Tcl_Release((ClientData) masterPtr->winPtr); ckfree((char *) masterPtr); } } |