[PATCH weston] desktop-shell: Get rid of the racy shell client's destroy listener

Boyan Ding stu_dby at 126.com
Sat Aug 23 00:02:35 PDT 2014


The only thing that desktop_shell_client_destroy() do is setting
shell->child.client NULL, and is also done by desktop_shell_sigchld().
Getting rid of it and the shell client's destroy_listener is safe and
avoids a handful of race conditions.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=82957
Signed-off-by: Boyan Ding <stu_dby at 126.com>
---
 desktop-shell/shell.c | 16 ----------------
 desktop-shell/shell.h |  1 -
 2 files changed, 17 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 99f3343..07700cf 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5322,17 +5322,6 @@ desktop_shell_sigchld(struct weston_process *process, int status)
 }
 
 static void
-desktop_shell_client_destroy(struct wl_listener *listener, void *data)
-{
-	struct desktop_shell *shell;
-
-	shell = container_of(listener, struct desktop_shell,
-			     child.client_destroy_listener);
-
-	shell->child.client = NULL;
-}
-
-static void
 launch_desktop_shell_process(void *data)
 {
 	struct desktop_shell *shell = data;
@@ -5344,11 +5333,6 @@ launch_desktop_shell_process(void *data)
 
 	if (!shell->child.client)
 		weston_log("not able to start %s\n", shell->client);
-
-	shell->child.client_destroy_listener.notify =
-		desktop_shell_client_destroy;
-	wl_client_add_destroy_listener(shell->child.client,
-				       &shell->child.client_destroy_listener);
 }
 
 static void
diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
index c6ea328..3ddaa89 100644
--- a/desktop-shell/shell.h
+++ b/desktop-shell/shell.h
@@ -137,7 +137,6 @@ struct desktop_shell {
 		struct weston_process process;
 		struct wl_client *client;
 		struct wl_resource *desktop_shell;
-		struct wl_listener client_destroy_listener;
 
 		unsigned deathcount;
 		uint32_t deathstamp;
-- 
2.1.0




More information about the wayland-devel mailing list