[Mesa-dev] [PATCH v2 1/6] vulkan: Fix Wayland uninitialised registry

Lionel Landwerlin lionel.g.landwerlin at intel.com
Fri May 19 01:31:00 UTC 2017


This series is :

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

Thanks for doing this.
Although you seem to have a multithreaded scenario in mind, this will 
probably help single threaded stacks like Clutter/Cogl & Mesa all using 
the same event queue.

-
Lionel

On 16/05/17 11:05, Daniel Stone wrote:
> Untangle the exit cleanup paths so we don't try to use the registry
> variable before it's been initialised.
>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Cc: mesa-stable at lists.freedesktop.org
> ---
>   src/vulkan/wsi/wsi_common_wayland.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
> index 5613283d9d..9c246b8d5c 100644
> --- a/src/vulkan/wsi/wsi_common_wayland.c
> +++ b/src/vulkan/wsi/wsi_common_wayland.c
> @@ -272,7 +272,7 @@ wsi_wl_display_create(struct wsi_wayland *wsi, struct wl_display *wl_display)
>   
>      struct wl_registry *registry = wl_display_get_registry(wl_display);
>      if (!registry)
> -      return NULL;
> +      goto fail;
>   
>      wl_registry_add_listener(registry, &registry_listener, display);
>   
> @@ -280,24 +280,25 @@ wsi_wl_display_create(struct wsi_wayland *wsi, struct wl_display *wl_display)
>      wl_display_roundtrip(wl_display);
>   
>      if (!display->drm)
> -      goto fail;
> +      goto fail_registry;
>   
>      /* Round-rip to get wl_drm formats and capabilities */
>      wl_display_roundtrip(wl_display);
>   
>      /* We need prime support */
>      if (!(display->capabilities & WL_DRM_CAPABILITY_PRIME))
> -      goto fail;
> +      goto fail_registry;
>   
>      /* We don't need this anymore */
>      wl_registry_destroy(registry);
>   
>      return display;
>   
> -fail:
> +fail_registry:
>      if (registry)
>         wl_registry_destroy(registry);
>   
> +fail:
>      wsi_wl_display_destroy(wsi, display);
>      return NULL;
>   }




More information about the mesa-dev mailing list