summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorJonas Ådahl <[email protected]>2012-12-25 13:01:08 +0100
committerKristian Høgsberg <[email protected]>2013-01-10 16:34:07 -0500
commitf2da7e720f60e8df96bf2530f35e3e79897e0cb7 (patch)
tree8ed0df609c88e4b0245f2fef2be2f2cfac721f99 /src/egl
parentf9d8d0c3b5e11c4ae08b078dca2aa48a3218f8d9 (diff)
wayland: Don't cancel a roundtrip when any event is received
Since wl_display_dispatch_queue() returns the number of processed events or -1 on error, only cancel the roundtrip if an -1 is returned. This also fixes a potential memory corruption bug happening when the roundtrip does an early return and the callback later writes to the then out of scope stack allocated `done' parameter. Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 9b77b7a21c8..59371d66fc9 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -70,6 +70,9 @@ roundtrip(struct dri2_egl_display *dri2_dpy)
while (ret != -1 && !done)
ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
+ if (!done)
+ wl_callback_destroy(callback);
+
return ret;
}