diff options
author | fvogelnew1@free.fr <fvogel> | 2016-05-30 18:33:40 (GMT) |
---|---|---|
committer | fvogelnew1@free.fr <fvogel> | 2016-05-30 18:33:40 (GMT) |
commit | 14cdf03f1fb102ea8271801f79aee09e6f040e79 (patch) | |
tree | 0feec6a06cde63ca3b4b0bd6129f1824451219db | |
parent | e75f629bf18f43b83ec5f4b0d98598d2c2e78072 (diff) | |
parent | fd2f9a00a1083ca590848518acdaf08579b14279 (diff) | |
download | tk-14cdf03f1fb102ea8271801f79aee09e6f040e79.zip tk-14cdf03f1fb102ea8271801f79aee09e6f040e79.tar.gz tk-14cdf03f1fb102ea8271801f79aee09e6f040e79.tar.bz2 |
Fixed [79549a9134] - Mouse pointer warping crashes
-rw-r--r-- | generic/tkBind.c | 13 | ||||
-rw-r--r-- | tests/bind.test | 12 |
2 files changed, 23 insertions, 2 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index 9cd3b7b..4374494 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -3535,8 +3535,17 @@ DoWarp( { TkDisplay *dispPtr = clientData; - TkpWarpPointer(dispPtr); - XForceScreenSaver(dispPtr->display, ScreenSaverReset); + /* + * DoWarp was scheduled only if the window was mapped. It needs to be + * still mapped at the time the present idle callback is executed. Also + * one needs to guard against window destruction in the meantime. + */ + + if (Tk_IsMapped(dispPtr->warpWindow) + && (Tk_WindowId(dispPtr->warpWindow) != None)) { + TkpWarpPointer(dispPtr); + XForceScreenSaver(dispPtr->display, ScreenSaverReset); + } dispPtr->flags &= ~TK_DISPLAY_IN_WARP; } diff --git a/tests/bind.test b/tests/bind.test index ab3fa15..ff1b4f9 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6101,6 +6101,18 @@ test bind-31.7 {virtual event user_data field - unshared, asynch} -setup { destroy .t.f } -result {{} {} {TestUserData >b<}} +test bind-32 {-warp, window was destroyed before the idle callback DoWarp} -setup { + frame .t.f + pack .t.f + focus -force .t.f + update +} -body { + event generate .t.f <Button-1> -warp 1 + destroy .t.f + update ; # shall simply not crash +} -cleanup { +} -result {} + # cleanup cleanupTests |