diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-05-10 09:04:55 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-05-10 09:04:55 (GMT) |
commit | e41b58b108a24a08463fbc083fbfae137d3a8897 (patch) | |
tree | 55fc6e0b57cc4d34e9c2bacb6d61d1e3762e3e33 /generic | |
parent | 900ca0d4015ef35172971ffe2cbc49f8205f42e3 (diff) | |
download | tk-e41b58b108a24a08463fbc083fbfae137d3a8897.zip tk-e41b58b108a24a08463fbc083fbfae137d3a8897.tar.gz tk-e41b58b108a24a08463fbc083fbfae137d3a8897.tar.bz2 |
New internal function TkpCancelWarp(), which does a proper warp clean-up when the display is closed. Follow-up to [db8c541b6bff91848c53006b0fe352136fbd4be9|db8c541b6b]. Backported from androwish [http://www.androwish.org/index.html/info/0b3392c9134c228f|0b3392c9134c228f] (which was a little more than just a "add tk upstream changes" ...). Thanks, Christian!
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkBind.c | 38 | ||||
-rw-r--r-- | generic/tkInt.h | 1 | ||||
-rw-r--r-- | generic/tkWindow.c | 2 |
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); } |