summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl
diff options
context:
space:
mode:
authorJonas Ådahl <[email protected]>2012-12-25 13:01:08 +0100
committerKristian Høgsberg <[email protected]>2013-01-03 11:44:55 -0500
commit800ed958c33092d694686fcc25c0283dfba86459 (patch)
tree5ee4cb699b871f26d0c73d8d8ea2a50da3f3254c /src/gallium/state_trackers/egl
parent622d96aae499445f12861214354a5b9f63e3a738 (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/gallium/state_trackers/egl')
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
index 560e40d4cee..941a0944518 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
@@ -57,9 +57,12 @@ wayland_roundtrip(struct wayland_display *display)
callback = wl_display_sync(display->dpy);
wl_callback_add_listener(callback, &sync_listener, &done);
wl_proxy_set_queue((struct wl_proxy *) callback, display->queue);
- while (ret == 0 && !done)
+ while (ret != -1 && !done)
ret = wl_display_dispatch_queue(display->dpy, display->queue);
+ if (!done)
+ wl_callback_destroy(callback);
+
return ret;
}