[vlc-devel] [PATCH] glspectrum: destroy OpenGL vout from the thread that created it

Felix Abecassis felix.abecassis at gmail.com
Thu Mar 6 12:41:51 CET 2014


Fix #9437
---
 modules/visualization/glspectrum.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/visualization/glspectrum.c b/modules/visualization/glspectrum.c
index 0a0a834..2e4281c 100644
--- a/modules/visualization/glspectrum.c
+++ b/modules/visualization/glspectrum.c
@@ -187,7 +187,6 @@ static void Close(vlc_object_t *p_this)
     vlc_join(p_sys->thread, NULL);
 
     /* Free the ressources */
-    vout_DeleteDisplay(p_sys->p_vd, NULL);
     vlc_object_release(p_sys->p_vout);
 
     block_FifoRelease(p_sys->fifo);
@@ -346,6 +345,14 @@ static void drawBars(float heights[])
     glPopMatrix();
 }
 
+static void ThreadCleanup(void *p_data)
+{
+    filter_t  *p_filter = (filter_t*)p_data;
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    if (p_sys->p_vd)
+        vout_DeleteDisplay(p_sys->p_vd, NULL);
+}
 
 /**
  * Update thread which do the rendering
@@ -361,6 +368,8 @@ static void *Thread( void *p_data )
     unsigned int i_last_width = 0;
     unsigned int i_last_height = 0;
 
+    vlc_cleanup_push(ThreadCleanup, p_filter);
+
     /* Create the openGL provider */
     p_sys->p_vout =
         (vout_thread_t *)vlc_object_create(p_filter, sizeof(vout_thread_t));
@@ -557,6 +566,7 @@ release:
 error:
     p_sys->b_error = true;
     vlc_sem_post(&p_sys->ready);
+    vlc_cleanup_run();
     return NULL;
 }
 
-- 
1.8.3.2




More information about the vlc-devel mailing list