diff options
author | dgp <dgp@users.sourceforge.net> | 2017-04-06 16:11:56 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-04-06 16:11:56 (GMT) |
commit | 0c9cc5316ee8883de4c5d4910cec9f7ad9d1f378 (patch) | |
tree | 67eb8b699abbe898981757b45e4c46eac9b5d8d2 /generic | |
parent | 37ffc5d06afe069f7266b77571fbb1442af47dc0 (diff) | |
parent | 022b25baf0934b5ec3218354645491aea7674b5b (diff) | |
download | tk-0c9cc5316ee8883de4c5d4910cec9f7ad9d1f378.zip tk-0c9cc5316ee8883de4c5d4910cec9f7ad9d1f378.tar.gz tk-0c9cc5316ee8883de4c5d4910cec9f7ad9d1f378.tar.bz2 |
merge 8.6
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkBind.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index 567c51f..61b44df 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -3466,12 +3466,28 @@ 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, + event.general.xmotion.window); + if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) { Tcl_DoWhenIdle(DoWarp, dispPtr); dispPtr->flags |= TK_DISPLAY_IN_WARP; } - dispPtr->warpWindow = Tk_IdToWindow(dispPtr->display, - event.general.xmotion.window); + + if (warpWindow != dispPtr->warpWindow) { + if (warpWindow) { + Tcl_Preserve(warpWindow); + } + if (dispPtr->warpWindow) { + Tcl_Release(dispPtr->warpWindow); + } + dispPtr->warpWindow = warpWindow; + } dispPtr->warpMainwin = mainWin; dispPtr->warpX = event.general.xmotion.x; dispPtr->warpY = event.general.xmotion.y; @@ -3559,6 +3575,11 @@ DoWarp( TkpWarpPointer(dispPtr); XForceScreenSaver(dispPtr->display, ScreenSaverReset); } + + if (dispPtr->warpWindow) { + Tcl_Release(dispPtr->warpWindow); + dispPtr->warpWindow = None; + } dispPtr->flags &= ~TK_DISPLAY_IN_WARP; } |