[Mesa-dev] [PATCH] egl/wayland: do not leak wl_buffer when it is locked
Juan A. Suarez Romero
jasuarez at igalia.com
Tue Aug 7 08:33:50 UTC 2018
On Thu, 2018-08-02 at 11:01 +0200, Juan A. Suarez Romero wrote:
> If color buffer is locked, do not set its wayland buffer to NULL;
> otherwise it can not be freed later.
>
> This also fixes dEQP-EGL.functional.swap_buffers_with_damage.* tests.
CC: Daniel Stone <daniels at collabora.com>
CC: Eric Engestrom <eric at engestrom.ch>
> ---
> src/egl/drivers/dri2/platform_wayland.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index dca099500a8..69e1dac0ff7 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -412,8 +412,11 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf)
>
> for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
> if (dri2_surf->color_buffers[i].wl_buffer &&
> - !dri2_surf->color_buffers[i].locked)
> + !dri2_surf->color_buffers[i].locked) {
> wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
> + dri2_surf->color_buffers[i].wl_buffer = NULL;
> + }
> +
> if (dri2_surf->color_buffers[i].dri_image)
> dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
> if (dri2_surf->color_buffers[i].linear_copy)
> @@ -422,11 +425,9 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf)
> munmap(dri2_surf->color_buffers[i].data,
> dri2_surf->color_buffers[i].data_size);
>
> - dri2_surf->color_buffers[i].wl_buffer = NULL;
> dri2_surf->color_buffers[i].dri_image = NULL;
> dri2_surf->color_buffers[i].linear_copy = NULL;
> dri2_surf->color_buffers[i].data = NULL;
> - dri2_surf->color_buffers[i].locked = false;
> }
>
> if (dri2_dpy->dri2)
More information about the mesa-dev
mailing list