1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-03 05:31:34 +00:00

vo_opengl: vaapi: fix cleanup

Don't call eglDestroyImageKHR() on the same ID possibly more than once.

Clear the image reference on termination, or we would leak up to 1 image
per VO recreation.
This commit is contained in:
wm4 2015-09-25 10:02:54 +02:00
parent 8d8a2045bd
commit 5786d07450

View File

@ -50,6 +50,7 @@ static void unref_image(struct gl_hwdec *hw)
for (int n = 0; n < 4; n++) { for (int n = 0; n < 4; n++) {
if (p->images[n]) if (p->images[n])
hw->gl->DestroyImageKHR(eglGetCurrentDisplay(), p->images[n]); hw->gl->DestroyImageKHR(eglGetCurrentDisplay(), p->images[n]);
p->images[n] = 0;
} }
va_lock(p->ctx); va_lock(p->ctx);
@ -83,6 +84,7 @@ static void destroy_textures(struct gl_hwdec *hw)
static void destroy(struct gl_hwdec *hw) static void destroy(struct gl_hwdec *hw)
{ {
struct priv *p = hw->priv; struct priv *p = hw->priv;
unref_image(hw);
destroy_textures(hw); destroy_textures(hw);
va_destroy(p->ctx); va_destroy(p->ctx);
} }