From ca314a25ccf81c9740d147c6b20de4c24b354301 Mon Sep 17 00:00:00 2001 From: Hyunjun Ko Date: Wed, 19 Apr 2017 10:37:19 +0900 Subject: libs: window: wayland: null buffer at destroy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix leakage of the last wl buffer. VAAPI wayland sink needs to send a null buffer while destruction, it assures that all the wl buffers are released. Otherwise, the last buffer's callback might be not called, which leads to leak of GstVaapiDisplay. This was inspired by gstwaylandsink. https://bugzilla.gnome.org/show_bug.cgi?id=774029 Signed-off-by: Víctor Manuel Jáquez Leal --- gst-libs/gst/vaapi/gstvaapiwindow_wayland.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c index e4797b7c21..ace2cffb04 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c @@ -319,6 +319,15 @@ gst_vaapi_window_wayland_destroy (GstVaapiWindow * window) /* Wait for the last frame to complete redraw */ gst_vaapi_window_wayland_sync (window); + /* Make sure that the last wl buffer's callback could be called */ + GST_VAAPI_OBJECT_LOCK_DISPLAY (window); + if (priv->surface) { + wl_surface_attach (priv->surface, NULL, 0, 0); + wl_surface_commit (priv->surface); + wl_display_flush (wl_display); + } + GST_VAAPI_OBJECT_UNLOCK_DISPLAY (window); + if (priv->event_queue) wl_display_roundtrip_queue (wl_display, priv->event_queue); -- cgit v1.2.1