From 7f7499c25733540fa3affd591ef3133b533eef89 Mon Sep 17 00:00:00 2001 From: mdejong Date: Tue, 18 Jun 2002 01:00:58 +0000 Subject: * 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. --- ChangeLog | 7 +++++++ generic/tkImage.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8293e5e..b708077 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-06-17 Mo DeJong + + * 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. + 2002-06-17 David Gravereaux Trims to support the removal of RESOURCE_INCLUDED from rc 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); } } -- cgit v0.12