summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkBind.c38
-rw-r--r--generic/tkInt.h1
-rw-r--r--generic/tkWindow.c2
3 files changed, 33 insertions, 8 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 61b44df..285b3f7 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;
@@ -2878,7 +2878,7 @@ GetAllVirtualEvents(
* Any other fields in eventPtr which are not specified by the pattern
* string or the optional arguments, are set to 0.
*
- * The event may be handled sychronously or asynchronously, depending on
+ * The event may be handled synchronously or asynchronously, depending on
* the value specified by the optional "-when" option. The default
* setting is synchronous.
*
@@ -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 f00d833..a28cae4 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 690a841..2848ff5 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);
}