[vlc-commits] opengl: fix deleting order

Thomas Guillem git at videolan.org
Mon Dec 11 17:26:55 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Dec 11 16:57:40 2017 +0100| [28f5370624a552cf765ca79df402125bd1fda10a] | committer: Thomas Guillem

opengl: fix deleting order

Textures should be deleted after the glconv modules are closed since they can
be still in use.

Fixes #19274

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

 modules/video_output/opengl/vout_helper.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 685c752d66..87e53a3a0f 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -987,32 +987,32 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
     vgl->vt.Finish();
     vgl->vt.Flush();
 
-    opengl_tex_converter_t *tc = vgl->prgm->tc;
-    if (!tc->handle_texs_gen)
-        DelTextures(tc, vgl->texture);
+    const size_t main_tex_count = vgl->prgm->tc->tex_count;
+    const bool main_del_texs = !vgl->prgm->tc->handle_texs_gen;
 
-    tc = vgl->sub_prgm->tc;
-    for (int i = 0; i < vgl->region_count; i++)
-    {
-        if (vgl->region[i].texture)
-            DelTextures(tc, &vgl->region[i].texture);
-    }
-    free(vgl->region);
+    if (vgl->pool)
+        picture_pool_Release(vgl->pool);
+    opengl_deinit_program(vgl, vgl->prgm);
+    opengl_deinit_program(vgl, vgl->sub_prgm);
 
     vgl->vt.DeleteBuffers(1, &vgl->vertex_buffer_object);
     vgl->vt.DeleteBuffers(1, &vgl->index_buffer_object);
-    vgl->vt.DeleteBuffers(vgl->prgm->tc->tex_count, vgl->texture_buffer_object);
+    vgl->vt.DeleteBuffers(main_tex_count, vgl->texture_buffer_object);
 
     if (vgl->subpicture_buffer_object_count > 0)
         vgl->vt.DeleteBuffers(vgl->subpicture_buffer_object_count,
                               vgl->subpicture_buffer_object);
     free(vgl->subpicture_buffer_object);
 
-    if (vgl->pool)
-        picture_pool_Release(vgl->pool);
-    opengl_deinit_program(vgl, vgl->prgm);
-    opengl_deinit_program(vgl, vgl->sub_prgm);
+    if (main_del_texs)
+        vgl->vt.DeleteTextures(main_tex_count, vgl->texture);
 
+    for (int i = 0; i < vgl->region_count; i++)
+    {
+        if (vgl->region[i].texture)
+            vgl->vt.DeleteTextures(1, &vgl->region[i].texture);
+    }
+    free(vgl->region);
     GL_ASSERT_NOERROR();
 
     free(vgl);



More information about the vlc-commits mailing list