summaryrefslogtreecommitdiffstats
path: root/generic/tkWindow.c
diff options
context:
space:
mode:
authormdejong <mdejong@noemail.net>2002-06-19 19:37:53 (GMT)
committermdejong <mdejong@noemail.net>2002-06-19 19:37:53 (GMT)
commitcba6aef6d993bf6bdf025d092aef7f718d68b61f (patch)
tree51116998e0729d291598a2a00efead102da3cb97 /generic/tkWindow.c
parent25e57e72bdca356a75991ba1689c0d6cec3dd2b1 (diff)
downloadtk-cba6aef6d993bf6bdf025d092aef7f718d68b61f.zip
tk-cba6aef6d993bf6bdf025d092aef7f718d68b61f.tar.gz
tk-cba6aef6d993bf6bdf025d092aef7f718d68b61f.tar.bz2
* generic/tkBind.c (TkBindDeadWindow):
Handle case where Tk_DestroyWindow is invoked on clipboard and send windows. * generic/tkClipboard.c (TkClipCleanup): Invoke Tk_DestroyWindow to cleanup the dispPtr->clipWindow. Call Tcl_Preserve and Tcl_Release on the window to avoid an invalid memory ref on shutdown. * generic/tkEvent.c (Tk_HandleEvent): Panic if XCreateIC is invoked twice for the same window. This should never happen, the check were just added to make sure it does not since this could lead to crashes in XCloseIM. * generic/tkFocus.c (TkFocusDeadWindow): Handle case where Tk_DestroyWindow is invoked on clipboard and send windows. * generic/tkOption.c (TkOptionDeadWindow): Ditto. * generic/tkWindow.c (TkCloseDisplay): Move deletion of dispPtr->winTable after TkpCloseDisplay call since Tk_DestroyWindow uses it and could be called by TkpCloseDisplay for clipboard/send windows. Also invoke ckfree for the dispPtr instead of doing it in TkpCloseDisplay. (Tk_DestroyWindow): Check for a null winPtr->mainPtr before doing certain cleanup tasks so the we can invoke Tk_DestroyWindow on clipboard and send windows. We need to do this so that XDestroyIC will get invoked for the input contexts of each window. * mac/tkMacXStubs.c (TkpCloseDisplay): Don't free the displayPtr since this is now done in TkCloseDisplay. * unix/tkUnixEvent.c (TkpCloseDisplay, OpenIM): Remove conditional compilation around calls to XCloseIM since I am confident that the crashes related to input contexts has been fixed. Don't free the displayPtr since this is now done in TkCloseDisplay. * unix/tkUnixSend.c (TkSendCleanup): Invoke the Tk_DestroyWindow method to cleanup the special send window. This will call XDestroyIC and thereby avoid a crash in XCloseIM. The send window needs to be Tcl_Preserve and Tcl_Release to avoid an invalid memory ref on shutdown. * win/tkWinX.c (TkpCloseDisplay): Don't free the displayPtr since this is now done in TkCloseDisplay. FossilOrigin-Name: 2b1442c6d82bdff73ad6575cabf7539bf0295292
Diffstat (limited to 'generic/tkWindow.c')
-rw-r--r--generic/tkWindow.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index e778e40..187dce4 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWindow.c,v 1.49 2002/06/18 23:51:46 dkf Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.50 2002/06/19 19:37:54 mdejong Exp $
*/
#include "tkPort.h"
@@ -240,8 +240,6 @@ TkCloseDisplay(TkDisplay *dispPtr)
ckfree(dispPtr->name);
}
- Tcl_DeleteHashTable(&dispPtr->winTable);
-
if (dispPtr->atomInit) {
Tcl_DeleteHashTable(&dispPtr->nameTable);
Tcl_DeleteHashTable(&dispPtr->atomTable);
@@ -263,6 +261,15 @@ TkCloseDisplay(TkDisplay *dispPtr)
TkpCloseDisplay(dispPtr);
/*
+ * Delete winTable after TkpCloseDisplay since special windows
+ * may need call Tk_DestroyWindow and it checks the winTable.
+ */
+
+ Tcl_DeleteHashTable(&dispPtr->winTable);
+
+ ckfree((char *) dispPtr);
+
+ /*
* There is more to clean up, we leave it at this for the time being.
*/
}
@@ -1262,7 +1269,7 @@ Tk_DestroyWindow(tkwin)
* can be closed and its data structures deleted.
*/
- if (winPtr->mainPtr->winPtr == winPtr) {
+ if (winPtr->mainPtr != NULL && winPtr->mainPtr->winPtr == winPtr) {
dispPtr->refCount--;
if (tsdPtr->mainWindowList == winPtr->mainPtr) {
tsdPtr->mainWindowList = winPtr->mainPtr->nextPtr;
@@ -1388,6 +1395,7 @@ Tk_DestroyWindow(tkwin)
#ifdef TK_USE_INPUT_METHODS
if (winPtr->inputContext != NULL) {
XDestroyIC(winPtr->inputContext);
+ winPtr->inputContext = NULL;
}
#endif /* TK_USE_INPUT_METHODS */
if (winPtr->tagPtr != NULL) {