[PATCH] wayland-server: Destroy Clients upon wl_display_destroy()

viveka vivekananth20 at gmail.com
Tue Dec 20 13:10:13 UTC 2016


From: "Vivek.A" <vivekananth20 at gmail.com>

    Without this, client socket file descriptors are being kept open until the process
    hosting the compositor gets terminated / exit. This causes compositor termination
    goes undetected through its fd. This could be reproduced by having compositor as
    one of the threads in a process.

    https://bugs.freedesktop.org/show_bug.cgi?id=99142

    Signed-off-by: Vivek.A <vivekananth20 at gmail.com>
---
 src/wayland-server.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 9d7d9c1..8195064 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -979,11 +979,16 @@ wl_socket_alloc(void)
 WL_EXPORT void
 wl_display_destroy(struct wl_display *display)
 {
+	struct wl_client *c, *cnext;
 	struct wl_socket *s, *next;
 	struct wl_global *global, *gnext;
 
 	wl_signal_emit(&display->destroy_signal, display);
 
+	wl_list_for_each_safe(c, cnext, &display->client_list, link) {
+		wl_client_destroy(c);
+	}
+
 	wl_list_for_each_safe(s, next, &display->socket_list, link) {
 		wl_socket_destroy(s);
 	}
-- 
1.9.1



More information about the wayland-devel mailing list