[vlc-devel] [PATCH 1/5] vout: win32: drawable: move the known hwnd removal in a function

Steve Lhomme robux4 at ycbcr.xyz
Thu May 7 14:39:08 CEST 2020


---
 modules/video_output/drawable.c | 44 +++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/modules/video_output/drawable.c b/modules/video_output/drawable.c
index a21c40ca0ad2..63dc6c8e87d3 100644
--- a/modules/video_output/drawable.c
+++ b/modules/video_output/drawable.c
@@ -64,6 +64,30 @@ static const struct vout_window_operations ops = {
     .destroy = Close,
 };
 
+static void RemoveDrawable(uintptr_t val)
+{
+    size_t n = 0;
+
+    /* Remove this drawable from the list of busy ones */
+    vlc_mutex_lock (&serializer);
+    assert (used != NULL);
+    while (used[n] != val)
+    {
+        assert (used[n]);
+        n++;
+    }
+    do
+        used[n] = used[n + 1];
+    while (used[++n] != 0);
+
+    if (n == 0)
+    {
+        free (used);
+        used = NULL;
+    }
+    vlc_mutex_unlock (&serializer);
+}
+
 /**
  * Find the drawable set by libvlc application.
  */
@@ -114,24 +138,6 @@ skip:
 static void Close (vout_window_t *wnd)
 {
     uintptr_t val = (uintptr_t)wnd->sys;
-    size_t n = 0;
 
-    /* Remove this drawable from the list of busy ones */
-    vlc_mutex_lock (&serializer);
-    assert (used != NULL);
-    while (used[n] != val)
-    {
-        assert (used[n]);
-        n++;
-    }
-    do
-        used[n] = used[n + 1];
-    while (used[++n] != 0);
-
-    if (n == 0)
-    {
-         free (used);
-         used = NULL;
-    }
-    vlc_mutex_unlock (&serializer);
+    RemoveDrawable(val);
 }
-- 
2.17.1



More information about the vlc-devel mailing list