[vlc-commits] vout: add missing spu_t checks

Thomas Guillem git at videolan.org
Thu Jun 6 07:40:15 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jun  3 15:20:06 2019 +0200| [3a8379b91e91c0d6a0b51c2a20de1596b453e720] | committer: Thomas Guillem

vout: add missing spu_t checks

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

 src/video_output/video_output.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 88b458e878..7c03c0b828 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1687,7 +1687,8 @@ void vout_StopDisplay(vout_thread_t *vout)
     if (sys->mouse_event)
         sys->mouse_event(NULL, sys->mouse_opaque);
 
-    spu_Detach(sys->spu);
+    if (sys->spu)
+        spu_Detach(sys->spu);
     sys->mouse_event = NULL;
     sys->clock = NULL;
     video_format_Clean(&sys->original);
@@ -1725,8 +1726,8 @@ void vout_Close(vout_thread_t *vout)
     vout_chrono_Clean(&sys->render);
 
     vlc_mutex_lock(&sys->spu_lock);
-    spu_Destroy(sys->spu);
-    sys->spu = NULL;
+    if (sys->spu)
+        spu_Destroy(sys->spu);
     vlc_mutex_unlock(&sys->spu_lock);
 
     vout_Release(vout);
@@ -1845,7 +1846,8 @@ vout_thread_t *vout_Create(vlc_object_t *object)
     /* Window */
     sys->display_cfg.window = vout_display_window_New(vout);
     if (sys->display_cfg.window == NULL) {
-        spu_Destroy(sys->spu);
+        if (sys->spu)
+            spu_Destroy(sys->spu);
         vlc_object_delete(vout);
         return NULL;
     }
@@ -1958,7 +1960,7 @@ error:
         return -1;
     }
 
-    if (input != NULL)
+    if (input != NULL && sys->spu)
         spu_Attach(sys->spu, input);
     vout_IntfReinit(vout);
     return 0;



More information about the vlc-commits mailing list