diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2001-04-12 12:30:42 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2001-04-12 12:30:42 (GMT) |
commit | f9e3816c8f035d2c1ff2613328fbb286230fa34b (patch) | |
tree | 9bd7c7e044d7a6edad8ed56ca153733ad7bfe543 /generic | |
parent | fe331f8e923d4a2673e6af3cb8e72e701821e64e (diff) | |
download | tk-f9e3816c8f035d2c1ff2613328fbb286230fa34b.zip tk-f9e3816c8f035d2c1ff2613328fbb286230fa34b.tar.gz tk-f9e3816c8f035d2c1ff2613328fbb286230fa34b.tar.bz2 |
Better handling of when image creation nukes the main window so now
does not crash on Linux.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkImage.c | 11 |
1 files changed, 8 insertions, 3 deletions
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); } } |