[vlc-commits] lua: don't force pushing an object to be released

Steve Lhomme git at videolan.org
Mon Mar 2 14:19:23 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Mar  2 12:08:32 2020 +0100| [87882838d8dc3e7f8ac000f1770a16ee2a282694] | committer: Steve Lhomme

lua: don't force pushing an object to be released

We could release all kinds of things we push (despite the function name).

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

 modules/lua/libs/objects.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c
index 9db1175ca9..d0b8a2e396 100644
--- a/modules/lua/libs/objects.c
+++ b/modules/lua/libs/objects.c
@@ -45,8 +45,8 @@
  *****************************************************************************/
 
 typedef struct vlclua_object {
-    vlc_object_t *object;
-    void (*release)(vlc_object_t *);
+    void *object;
+    void (*release)(void *);
 } vlclua_object_t;
 
 static int vlclua_release_vlc_object(lua_State *L)
@@ -59,8 +59,8 @@ static int vlclua_release_vlc_object(lua_State *L)
     return 0;
 }
 
-static int vlclua_push_vlc_object(lua_State *L, vlc_object_t *p_obj,
-                                  void (*release)(vlc_object_t *))
+static int vlclua_push_vlc_object(lua_State *L, void *p_obj,
+                                  void (*release)(void *))
 {
     vlclua_object_t *udata =
         (vlclua_object_t *)lua_newuserdata(L, sizeof (vlclua_object_t));
@@ -83,7 +83,7 @@ static int vlclua_push_vlc_object(lua_State *L, vlc_object_t *p_obj,
 static int vlclua_get_libvlc( lua_State *L )
 {
     libvlc_int_t *p_libvlc = vlc_object_instance(vlclua_get_this( L ));
-    vlclua_push_vlc_object(L, VLC_OBJECT(p_libvlc), NULL);
+    vlclua_push_vlc_object(L, p_libvlc, NULL);
     return 1;
 }
 
@@ -111,7 +111,7 @@ static int vlclua_get_vout( lua_State *L )
 {
     vout_thread_t *vout = vlclua_get_vout_internal(L);
     if (vout)
-        vlclua_push_vlc_object(L, VLC_OBJECT(vout), vout_Release);
+        vlclua_push_vlc_object(L, vout, vout_Release);
     else
         lua_pushnil(L);
     return 1;
@@ -121,7 +121,7 @@ static int vlclua_get_aout( lua_State *L )
 {
     audio_output_t *aout = vlclua_get_aout_internal(L);
     if (aout)
-        vlclua_push_vlc_object(L, VLC_OBJECT(aout), aout_Release);
+        vlclua_push_vlc_object(L, aout, aout_Release);
     else
         lua_pushnil(L);
     return 1;



More information about the vlc-commits mailing list