[PATCH 2/5] shell: don't crash on get_shell_surface with non-client surfaces

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Fri Feb 10 08:31:35 PST 2012


This avoids a crash if surface_attach() is called with a surface
created with weston_surface_create that are not added to client
space.
---
 src/shell.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index 53b192c..3e4ae8a 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -609,6 +609,9 @@ get_shell_surface(struct weston_surface *surface)
 	struct wl_list *lst = &surface->surface.resource.destroy_listener_list;
 	struct wl_listener *listener;
 
+	if (surface->surface.resource.client == NULL)
+		return NULL;
+
 	/* search the destroy listener list for our callback */
 	wl_list_for_each(listener, lst, link) {
 		if (listener->func == shell_handle_surface_destroy) {
-- 
1.7.4.1



More information about the wayland-devel mailing list