summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkBind.c36
-rw-r--r--generic/tkInt.h1
-rw-r--r--generic/tkWindow.c2
3 files changed, 32 insertions, 7 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index aaa5386..e0cc1ca 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -1267,7 +1267,7 @@ Tk_BindEvent(
*/
if ((eventPtr->type >= TK_LASTEVENT) || !flagArray[eventPtr->type]) {
- return;
+ return;
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -3466,12 +3466,7 @@ HandleEventGenerate(
if ((warp != 0) && Tk_IsMapped(tkwin)) {
TkDisplay *dispPtr = TkGetDisplay(event.general.xmotion.display);
- /*
- * TODO: No protection is in place to handle dispPtr destruction
- * before DoWarp is called back.
- */
-
- Tk_Window warpWindow = Tk_IdToWindow(dispPtr->display,
+Tk_Window warpWindow = Tk_IdToWindow(dispPtr->display,
event.general.xmotion.window);
if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) {
@@ -4321,6 +4316,33 @@ TkpGetBindingXEvent(
}
/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCancelWarp --
+ *
+ * This function cancels an outstanding pointer warp and
+ * is called during tear down of the display.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpCancelWarp(
+ TkDisplay *dispPtr)
+{
+ if (dispPtr->flags & TK_DISPLAY_IN_WARP) {
+ Tcl_CancelIdleCall(DoWarp, dispPtr);
+ dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
+ }
+}
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 3138ffc..474cfb0 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1223,6 +1223,7 @@ MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp,
MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp,
ClientData clientData);
MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr);
+MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr);
MODULE_SCOPE int TkListCreateFrame(ClientData clientData,
Tcl_Interp *interp, Tcl_Obj *listObj,
int toplevel, Tcl_Obj *nameObj);
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index ed57280..d9b5dec 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -239,6 +239,8 @@ TkCloseDisplay(
{
TkClipCleanup(dispPtr);
+ TkpCancelWarp(dispPtr);
+
if (dispPtr->name != NULL) {
ckfree(dispPtr->name);
}