diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-07-09 11:57:02 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2013-07-10 10:30:39 +1000 |
commit | 8b660cd307297c13771996fa77fe366f98162305 (patch) | |
tree | 5c84513082b880408bcd0ae6e8c85f5cccd7c278 | |
parent | a43c7831739a0ea6ed61ec2058d03dffc396dc92 (diff) |
server/grab: add test case for ungrab during second touch
This currently crashes the server, the listener is removed and triggers a
bug, replaying the event after the ungrab means accessing dangling pointers.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | tests/server/grab.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/server/grab.cpp b/tests/server/grab.cpp index a883bae..c7147b7 100644 --- a/tests/server/grab.cpp +++ b/tests/server/grab.cpp @@ -1015,6 +1015,55 @@ class TouchGrabTestOnLegacyClient : public TouchGrabTest { } }; +TEST_F(TouchGrabTestOnLegacyClient, ActivePointerGrabUngrabDuringTouch) +{ + XORG_TESTCASE("Create window\n" + "Select for button events on XIAllMasterDevices.\n" + "Touch begin\n" + "Activate async active grab on the window\n" + "Touch end, second touch begin\n" + "Ungrab device\n" + "https://bugs.freedesktop.org/show_bug.cgi?id=66720"); + + ::Display *dpy = Display(); /* XI 2.0 client */ + + int deviceid; + FindInputDeviceByName(dpy, "--device--", &deviceid); + + Window win = CreateWindow(dpy, DefaultRootWindow(dpy)); + + SelectXI2Events(dpy, XIAllMasterDevices, win, + XI_ButtonPress, + XI_ButtonRelease, + XI_Enter, + XI_Leave, + XI_Motion, + -1); + + TouchBegin(200, 200); + TouchUpdate(202, 202); + + EXPECT_EVENT(XIDeviceEvent, m1, dpy, GenericEvent, xi2_opcode, XI_Motion); + EXPECT_EVENT(XIDeviceEvent, p1, dpy, GenericEvent, xi2_opcode, XI_ButtonPress); + ASSERT_TRUE(NoEventPending(dpy)); + + GrabPointer(dpy, VIRTUAL_CORE_POINTER_ID, win); + TouchEnd(); + + EXPECT_EVENT(XIDeviceEvent, r1, dpy, GenericEvent, xi2_opcode, XI_ButtonRelease); + + TouchBegin(200, 200); + TouchUpdate(202, 202); + EXPECT_EVENT(XIDeviceEvent, m2, dpy, GenericEvent, xi2_opcode, XI_Motion); + EXPECT_EVENT(XIDeviceEvent, p2, dpy, GenericEvent, xi2_opcode, XI_ButtonPress); + XIUngrabDevice(dpy, VIRTUAL_CORE_POINTER_ID, CurrentTime); + + TouchEnd(); + + ASSERT_TRUE(NoEventPending(dpy)); +} + + TEST_F(TouchGrabTestOnLegacyClient, ActivePointerGrabOverPointerSelection) { XORG_TESTCASE("Create window\n" |