[vlc-commits] modules: move vlc_objres_clear()

Rémi Denis-Courmont git at videolan.org
Mon Mar 4 21:05:46 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar  4 21:05:26 2019 +0200| [7079430574dd08c1391f1b7c05cf0eeda2776193] | committer: Rémi Denis-Courmont

modules: move vlc_objres_clear()

This fixes an imbalance with vlc_tls and vout_window.
Now vlc_objres_clear() is always called in deactivation if and only it
is called in activation failure, and then only called once.

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

 src/modules/modules.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/modules/modules.c b/src/modules/modules.c
index bb9922d0dd..e7c2a04d68 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -168,9 +168,6 @@ static int module_load (vlc_object_t *obj, module_t *m,
         va_end (ap);
     }
 
-    if (ret != VLC_SUCCESS)
-        vlc_objres_clear(obj);
-
     return ret;
 }
 
@@ -304,8 +301,6 @@ void vlc_module_unload(vlc_object_t *obj, module_t *module,
         deinit(module->pf_deactivate, ap);
         va_end(ap);
     }
-
-    vlc_objres_clear(obj);
 }
 
 
@@ -313,9 +308,13 @@ static int generic_start(void *func, bool forced, va_list ap)
 {
     vlc_object_t *obj = va_arg(ap, vlc_object_t *);
     int (*activate)(vlc_object_t *) = func;
+    int ret;
 
     obj->obj.force = forced;
-    return activate(obj);
+    ret = activate(obj);
+    if (ret != VLC_SUCCESS)
+        vlc_objres_clear(obj);
+    return ret;
 }
 
 static void generic_stop(void *func, va_list ap)
@@ -348,6 +347,7 @@ void module_unneed(vlc_object_t *obj, module_t *module)
     msg_Dbg(obj, "removing module \"%s\"", module_get_object(module));
     var_Destroy(obj, "module-name");
     vlc_module_unload(obj, module, generic_stop, obj);
+    vlc_objres_clear(obj);
 }
 
 /**



More information about the vlc-commits mailing list