summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkBind.c9
-rw-r--r--generic/tkClipboard.c12
-rw-r--r--generic/tkEvent.c6
-rw-r--r--generic/tkFocus.c10
-rw-r--r--generic/tkOption.c4
-rw-r--r--generic/tkWindow.c16
6 files changed, 41 insertions, 16 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index e472d8e..c70a1a5 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.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: tkBind.c,v 1.24 2002/06/15 02:15:51 hobbs Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.25 2002/06/19 19:37:53 mdejong Exp $
*/
#include "tkPort.h"
@@ -1907,6 +1907,13 @@ TkBindDeadWindow(winPtr)
BindInfo *bindInfoPtr;
PendingBinding *curPtr;
+ /*
+ * Certain special windows like those used for send and clipboard
+ * have no mainPtr.
+ */
+ if (winPtr->mainPtr == NULL)
+ return;
+
bindInfoPtr = (BindInfo *) winPtr->mainPtr->bindInfo;
curPtr = bindInfoPtr->pendingList;
while (curPtr != NULL) {
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 149f65d..c43d621 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.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: tkClipboard.c,v 1.9 2002/04/12 10:03:02 hobbs Exp $
+ * RCS: @(#) $Id: tkClipboard.c,v 1.10 2002/06/19 19:37:54 mdejong Exp $
*/
#include "tkInt.h"
@@ -649,12 +649,9 @@ TkClipCleanup(dispPtr)
dispPtr->applicationAtom);
Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
dispPtr->windowAtom);
- /*
- * It may be too late to call Tk_DestroyWindow, so just free the
- * memory created directly.
- */
- ckfree((char *) dispPtr->clipWindow);
- dispPtr->clipWindow = NULL;
+
+ Tk_DestroyWindow(dispPtr->clipWindow);
+ Tcl_Release((ClientData) dispPtr->clipWindow);
}
}
@@ -700,6 +697,7 @@ TkClipInit(interp, dispPtr)
if (dispPtr->clipWindow == NULL) {
return TCL_ERROR;
}
+ Tcl_Preserve((ClientData) dispPtr->clipWindow);
atts.override_redirect = True;
Tk_ChangeWindowAttributes(dispPtr->clipWindow, CWOverrideRedirect, &atts);
Tk_MakeWindowExist(dispPtr->clipWindow);
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 754b451..009e2f5 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.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: tkEvent.c,v 1.15 2002/06/15 02:08:12 hobbs Exp $
+ * RCS: @(#) $Id: tkEvent.c,v 1.16 2002/06/19 19:37:54 mdejong Exp $
*/
#include "tkPort.h"
@@ -888,6 +888,8 @@ Tk_HandleEvent(eventPtr)
preedit_attr = XVaCreateNestedList(0, XNSpotLocation,
&spot, XNFontSet, dispPtr->inputXfs, NULL);
+ if (winPtr->inputContext != NULL)
+ panic("inputContext not NULL");
winPtr->inputContext = XCreateIC(dispPtr->inputMethod,
XNInputStyle, XIMPreeditPosition|XIMStatusNothing,
XNClientWindow, winPtr->window,
@@ -897,6 +899,8 @@ Tk_HandleEvent(eventPtr)
XFree(preedit_attr);
} else
#endif
+ if (winPtr->inputContext != NULL)
+ panic("inputContext not NULL");
winPtr->inputContext = XCreateIC(dispPtr->inputMethod,
XNInputStyle, XIMPreeditNothing|XIMStatusNothing,
XNClientWindow, winPtr->window,
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index b1ba279..f31d2a3 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFocus.c,v 1.8 2002/06/14 22:25:12 jenglish Exp $
+ * RCS: @(#) $Id: tkFocus.c,v 1.9 2002/06/19 19:37:54 mdejong Exp $
*/
#include "tkInt.h"
@@ -813,6 +813,14 @@ TkFocusDeadWindow(winPtr)
TkDisplay *dispPtr = winPtr->dispPtr;
/*
+ * Certain special windows like those used for send and clipboard
+ * have no mainPtr.
+ */
+
+ if (winPtr->mainPtr == NULL)
+ return;
+
+ /*
* Search for focus records that refer to this window either as
* the top-level window or the current focus window.
*/
diff --git a/generic/tkOption.c b/generic/tkOption.c
index d562e6c..227ae40 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.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: tkOption.c,v 1.13 2002/06/15 21:02:20 mdejong Exp $
+ * RCS: @(#) $Id: tkOption.c,v 1.14 2002/06/19 19:37:54 mdejong Exp $
*/
#include "tkPort.h"
@@ -787,7 +787,7 @@ TkOptionDeadWindow(winPtr)
* database.
*/
- if ((winPtr->mainPtr->winPtr == winPtr)
+ if ((winPtr->mainPtr != NULL) && (winPtr->mainPtr->winPtr == winPtr)
&& (winPtr->mainPtr->optionRootPtr != NULL)) {
ClearOptionTree(winPtr->mainPtr->optionRootPtr);
winPtr->mainPtr->optionRootPtr = NULL;
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) {