From 727c7903b27870bed0063814dd594466f21bf6eb Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 25 Feb 2021 23:49:00 +0100 Subject: [PATCH] client: assert queue display matches proxy In wl_proxy_set_queue, passing a wl_event_queue from a completely unrelated wl_display could lead to object IDs mismatches. Add an assertion to catch this case. It's always a user bug if this happens. Signed-off-by: Simon Ser --- src/wayland-client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index 21d46067..58531eb0 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -2177,10 +2177,12 @@ wl_proxy_get_class(struct wl_proxy *proxy) WL_EXPORT void wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue) { - if (queue) + if (queue) { + assert(proxy->display == queue->display); proxy->queue = queue; - else + } else { proxy->queue = &proxy->display->default_queue; + } } /** Create a proxy wrapper for making queue assignments thread-safe