libs: window: wayland: null buffer at destroy()

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 <vjaquez@igalia.com>
This commit is contained in:
Hyunjun Ko 2017-04-19 10:37:19 +09:00 committed by Víctor Manuel Jáquez Leal
parent 896a836f1d
commit ca314a25cc

View file

@ -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);