diff options
author | mdejong <mdejong> | 2002-06-18 01:00:58 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2002-06-18 01:00:58 (GMT) |
commit | 7f7499c25733540fa3affd591ef3133b533eef89 (patch) | |
tree | f8b3397df20ef5796f42ffc5a72cf39d27e48a7d /generic | |
parent | a3b521920369a70d6b12ecb63c9c17670739c7da (diff) | |
download | tk-7f7499c25733540fa3affd591ef3133b533eef89.zip tk-7f7499c25733540fa3affd591ef3133b533eef89.tar.gz tk-7f7499c25733540fa3affd591ef3133b533eef89.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); } } |