vulkan/wsi/wayland: always initialize format vector
authorLeandro Ribeiro <leandro.ribeiro@collabora.com>
Thu, 5 Aug 2021 16:08:48 +0000 (13:08 -0300)
committerSimon Ser <contact@emersion.fr>
Mon, 16 Aug 2021 08:22:50 +0000 (10:22 +0200)
commitcb3b4609c1ac067bd066a01286fa19ce029804a0
treebde961a8c2e35bd512f2722f640e37f4def822a7
parent151b65b211907d92f3012997aba12b7dbe004e61
vulkan/wsi/wayland: always initialize format vector

In wsi_wl_display_init(), the format vector is initialized only when the
caller sets the function to query the formats/modifiers. But
wsi_wl_display_finish() always release the vector, no matter if it has
been initialized or not.

For now it just works because the u_vector_foreach() macro works when
the format vector is uninitialized, but it is a weird design to try to
release something that has not been initialized.

So in this patch we start to always initialize the format vector, even
when not querying formats/modifiers.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
src/vulkan/wsi/wsi_common_wayland.c