[vlc-commits] wayland/shm: fix picture leak at reset

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:51:14 2017 +0200| [588cd0f7a68cdb6f03151c80d7eb6a207efffbee] | committer: Rémi Denis-Courmont

wayland/shm: fix picture leak at reset

We need to explicitly detach any buffer that is currently attached to
the display server. The display server will not (cannot) emit a buffer
release event after we destroy the buffer object.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=588cd0f7a68cdb6f03151c80d7eb6a207efffbee
---

 modules/video_output/wayland/shm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index d07240a..8de51a3 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -90,6 +90,11 @@ static void PictureDetach(void *data, picture_t *pic)
 {
     struct wl_buffer *buf = (struct wl_buffer *)pic->p_sys;
 
+    /* Detach the buffer if it is attached */
+    pic = wl_buffer_get_user_data(buf);
+    if (pic != NULL)
+        buffer_release_cb(pic, buf);
+
     wl_buffer_destroy(buf);
     (void) data;
 }



More information about the vlc-commits mailing list