summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2001-04-12 12:30:42 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2001-04-12 12:30:42 (GMT)
commitf9e3816c8f035d2c1ff2613328fbb286230fa34b (patch)
tree9bd7c7e044d7a6edad8ed56ca153733ad7bfe543
parentfe331f8e923d4a2673e6af3cb8e72e701821e64e (diff)
downloadtk-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.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkImage.c11
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 <fellowsd@cs.man.ac.uk>
+
+ * generic/tkImage.c (Tk_ImageObjCmd,DeleteImage): Better detection
+ of deletion when world is falling apart. [Bug #220819]
+
2001-04-04 Jeff Hobbs <jeffh@ActiveState.com>
* 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);
}
}