summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-05-26 20:46:06 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-05-26 20:46:06 (GMT)
commitef21094dd7164fbf1d96d8c33570f4803b7e35e6 (patch)
tree2fab67c4ed0e4acafdb7b17c3f7472bd431532c9
parentbfc87e3ce9f57f6f966f6cf423d1064487cb887b (diff)
downloadtk-ef21094dd7164fbf1d96d8c33570f4803b7e35e6.zip
tk-ef21094dd7164fbf1d96d8c33570f4803b7e35e6.tar.gz
tk-ef21094dd7164fbf1d96d8c33570f4803b7e35e6.tar.bz2
More complete fix for [79549a9134] - Mouse pointer warping crashes, with a non-regression test case.
-rw-r--r--generic/tkBind.c7
-rw-r--r--tests/bind.test12
2 files changed, 16 insertions, 3 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 81c768b..4374494 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -3537,11 +3537,12 @@ DoWarp(
/*
* DoWarp was scheduled only if the window was mapped. It needs to be
- * still mapped at the time the present idle callback is executed. In
- * particular, this guards against window destruction in the meantime.
+ * 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)) {
+ if (Tk_IsMapped(dispPtr->warpWindow)
+ && (Tk_WindowId(dispPtr->warpWindow) != None)) {
TkpWarpPointer(dispPtr);
XForceScreenSaver(dispPtr->display, ScreenSaverReset);
}
diff --git a/tests/bind.test b/tests/bind.test
index 474771d..387b119 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -6093,6 +6093,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