From f9e3816c8f035d2c1ff2613328fbb286230fa34b Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 12 Apr 2001 12:30:42 +0000 Subject: Better handling of when image creation nukes the main window so now does not crash on Linux. --- ChangeLog | 5 +++++ generic/tkImage.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd35b71..687f766 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-04-12 Donal K. Fellows + + * generic/tkImage.c (Tk_ImageObjCmd,DeleteImage): Better detection + of deletion when world is falling apart. [Bug #220819] + 2001-04-04 Jeff Hobbs * win/tkWinMenu.c (TkWinHandleMenuEvent): corrected reseting of diff --git a/generic/tkImage.c b/generic/tkImage.c index c556b2b..b629816 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.11 2001/03/30 22:42:10 hobbs Exp $ + * RCS: @(#) $Id: tkImage.c,v 1.12 2001/04/12 12:30:42 dkf Exp $ */ #include "tkInt.h" @@ -69,7 +69,9 @@ typedef struct ImageMaster { * entry). */ Image *instancePtr; /* Pointer to first in list of instances * derived from this name. */ - int deleted; /* Flag set when image is being deleted */ + int deleted; /* Flag set when image is being deleted. */ + TkWindow *winPtr; /* Main window of interpreter (used to + * detect when the world is falling apart.) */ } ImageMaster; typedef struct ThreadSpecificData { @@ -254,6 +256,7 @@ Tk_ImageObjCmd(clientData, interp, objc, objv) masterPtr->hPtr = hPtr; masterPtr->instancePtr = NULL; masterPtr->deleted = 0; + masterPtr->winPtr = winPtr->mainPtr->winPtr; Tcl_SetHashValue(hPtr, masterPtr); } else { /* @@ -908,7 +911,9 @@ DeleteImage(masterPtr) (*typePtr->deleteProc)(masterPtr->masterData); } if (masterPtr->instancePtr == NULL) { - Tcl_DeleteHashEntry(masterPtr->hPtr); + if ((masterPtr->winPtr->flags & TK_ALREADY_DEAD) == 0) { + Tcl_DeleteHashEntry(masterPtr->hPtr); + } ckfree((char *) masterPtr); } } -- cgit v0.12