[vlc-commits] wayland/shm: fix picture release (fix #17956)
Rémi Denis-Courmont
git at videolan.org
Sun Jan 29 17:52:40 CET 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 29 18:38:31 2017 +0200| [709e92cc666d2fffdd3f2c565fbd410cdf39592c] | committer: Rémi Denis-Courmont
wayland/shm: fix picture release (fix #17956)
When the compositor no longer needs the buffer, release the picture
that was held, not the one that originally contained the buffer.
(The mismatch is an unfortunate side effect of pooling and cloning.)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=709e92cc666d2fffdd3f2c565fbd410cdf39592c
---
modules/video_output/wayland/shm.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index c7c6e8a..d07240a 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -72,8 +72,13 @@ static void buffer_release_cb(void *data, struct wl_buffer *buffer)
{
picture_t *pic = data;
- picture_Release(pic);
+#ifndef NDEBUG
+ assert(pic != NULL);
+ wl_buffer_set_user_data(buffer, NULL);
+#else
(void) buffer;
+#endif
+ picture_Release(pic);
}
static const struct wl_buffer_listener buffer_cbs =
@@ -81,14 +86,6 @@ static const struct wl_buffer_listener buffer_cbs =
buffer_release_cb,
};
-static void PictureAttach(void *data, picture_t *pic)
-{
- struct wl_buffer *buf = (struct wl_buffer *)pic->p_sys;
-
- wl_buffer_add_listener(buf, &buffer_cbs, pic);
- (void) data;
-}
-
static void PictureDetach(void *data, picture_t *pic)
{
struct wl_buffer *buf = (struct wl_buffer *)pic->p_sys;
@@ -187,6 +184,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
break;
}
+ wl_buffer_add_listener(buf, &buffer_cbs, NULL);
pics[count++] = pic;
}
@@ -203,10 +201,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
{
while (count > 0)
picture_Release(pics[--count]);
- return NULL;
}
-
- picture_pool_Enum(sys->pool, PictureAttach, NULL);
return sys->pool;
}
@@ -217,6 +212,7 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
struct wl_surface *surface = sys->embed->handle.wl;
struct wl_buffer *buf = (struct wl_buffer *)pic->p_sys;
+ wl_buffer_set_user_data(buf, pic);
wl_surface_attach(surface, buf, sys->x, sys->y);
wl_surface_damage(surface, 0, 0,
vd->cfg->display.width, vd->cfg->display.height);
More information about the vlc-commits
mailing list