[PATCH v2] shell: Do not hang when mapping a popup twice

Kristian Høgsberg hoegsberg at gmail.com
Mon Feb 18 14:11:08 PST 2013


On Mon, Feb 18, 2013 at 10:26:01PM +0100, Giulio Camuffo wrote:
> When calling shell_map_popup() more than one time on the same shell_surface
> the parent transform was getting added more than one time to the transform
> list, resulting in an infinite loop when going through the list with
> wl_list_for_each in weston_surface_update_transform_enable().
> This commit removes the old transform before adding it again.

Thanks, looks good, committed.

Kristian

> ---
>  src/shell.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/shell.c b/src/shell.c
> index ea4daa8..af802a5 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -1900,6 +1900,14 @@ shell_map_popup(struct shell_surface *shsurf)
>  	struct weston_surface *es = shsurf->surface;
>  	struct weston_surface *parent = shsurf->parent;
>  
> +	/* Remove the old transform. We don't want to add it twice
> +	 * otherwise Weston will go into an infinite loop when going
> +	 * through the transforms. */
> +	if (!wl_list_empty(&shsurf->popup.parent_transform.link)) {
> +		wl_list_remove(&shsurf->popup.parent_transform.link);
> +		wl_list_init(&shsurf->popup.parent_transform.link);
> +	}
> +
>  	es->output = parent->output;
>  	shsurf->popup.grab.interface = &popup_grab_interface;
>  
> @@ -2070,6 +2078,7 @@ create_shell_surface(void *shell, struct weston_surface *surface,
>  	weston_matrix_init(&shsurf->rotation.rotation);
>  
>  	wl_list_init(&shsurf->workspace_transform.link);
> +	wl_list_init(&shsurf->popup.parent_transform.link);
>  
>  	shsurf->type = SHELL_SURFACE_NONE;
>  	shsurf->next_type = SHELL_SURFACE_NONE;
> -- 
> 1.8.1.3
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list