[vlc-commits] splitter: partially handle close event

Rémi Denis-Courmont git at videolan.org
Sun Jan 13 14:55:05 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 13 15:12:02 2019 +0200| [f9796a7ad18266b8213bf3053333ffe5fad12dc2] | committer: Rémi Denis-Courmont

splitter: partially handle close event

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

 modules/video_output/splitter.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c
index 8a6fcd1244..94d1365add 100644
--- a/modules/video_output/splitter.c
+++ b/modules/video_output/splitter.c
@@ -105,8 +105,16 @@ static void vlc_vidsplit_Close(vout_display_t *vd)
 
     for (int i = 0; i < n; i++) {
         struct vlc_vidsplit_part *part = &sys->parts[i];
+        vout_display_t *display;
+
+        vlc_sem_wait(&part->lock);
+        display = part->display;
+        part->display = NULL;
+        vlc_sem_post(&part->lock);
+
+        if (display != NULL)
+            vout_display_Delete(display);
 
-        vout_display_Delete(part->display);
         vout_window_Disable(part->window);
         vout_window_Delete(part->window);
         vlc_sem_destroy(&part->lock);
@@ -131,9 +139,24 @@ static void vlc_vidsplit_window_Resized(vout_window_t *wnd,
     vlc_sem_post(&part->lock);
 }
 
+static void vlc_vidsplit_window_Closed(vout_window_t *wnd)
+{
+    struct vlc_vidsplit_part *part = wnd->owner.sys;
+    vout_display_t *display;
+
+    vlc_sem_wait(&part->lock);
+    display = part->display;
+    part->display = NULL;
+    vlc_sem_post(&part->lock);
+
+    if (display != NULL)
+        vout_display_Delete(display);
+}
+
 static const struct vout_window_callbacks vlc_vidsplit_window_cbs =
 {
     .resized = vlc_vidsplit_window_Resized,
+    .closed = vlc_vidsplit_window_Closed,
 };
 
 static vout_window_t *video_splitter_CreateWindow(vlc_object_t *obj,



More information about the vlc-commits mailing list