[vlc-devel] [PATCH] core: object: clear res from vlc_object_delete()

Rémi Denis-Courmont remi at remlab.net
Mon Jan 27 15:00:05 CET 2020


Hi,

I don't think that we require an object to be deleted after a single module probe though (unlike the kernel), or do we?

Le 27 janvier 2020 15:18:53 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>Instead of clearing them from all kind of modules API.
>
>This will allow to use vlc_obj_*alloc() from all modules without
>wondering if
>resources will be cleaned. Indeed, some modules have their own close
>callbacks
>that don't need module_unneed() (that was calling vlc_objres_clear())
>to be
>called to release them.
>
>Furthermore, vlc_objres_clear() is an internal API, so submodules using
>an API
>defined in modules and a close callback could not benefit from it.
>---
> src/input/decoder_helpers.c | 1 -
> src/misc/objects.c          | 1 +
> src/modules/modules.c       | 2 --
> src/network/tls.c           | 2 --
> src/video_output/display.c  | 2 --
> src/video_output/opengl.c   | 1 -
> src/video_output/window.c   | 1 -
> 7 files changed, 1 insertion(+), 9 deletions(-)
>
>diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
>index e59cdcb3a10..ae022796336 100644
>--- a/src/input/decoder_helpers.c
>+++ b/src/input/decoder_helpers.c
>@@ -222,7 +222,6 @@ vlc_decoder_device_Release(vlc_decoder_device
>*device)
>     {
>         if (device->ops->close != NULL)
>             device->ops->close(device);
>-        vlc_objres_clear(VLC_OBJECT(device));
>         vlc_object_delete(device);
>     }
> }
>diff --git a/src/misc/objects.c b/src/misc/objects.c
>index f87edd9827f..370f7a92e98 100644
>--- a/src/misc/objects.c
>+++ b/src/misc/objects.c
>@@ -135,6 +135,7 @@ void vlc_object_deinit(vlc_object_t *obj)
> 
> void (vlc_object_delete)(vlc_object_t *obj)
> {
>+    vlc_objres_clear(obj);
>     vlc_object_deinit(obj);
>     free(obj);
> }
>diff --git a/src/modules/modules.c b/src/modules/modules.c
>index 2df5702f840..93ca5c8fa75 100644
>--- a/src/modules/modules.c
>+++ b/src/modules/modules.c
>@@ -272,8 +272,6 @@ void module_unneed(vlc_object_t *obj, module_t
>*module)
> 
>     if (module->deactivate != NULL)
>         module->deactivate(obj);
>-
>-    vlc_objres_clear(obj);
> }
> 
> module_t *module_find (const char *name)
>diff --git a/src/network/tls.c b/src/network/tls.c
>index 2fde82d61a4..3cf7546691f 100644
>--- a/src/network/tls.c
>+++ b/src/network/tls.c
>@@ -101,7 +101,6 @@ void vlc_tls_ServerDelete(vlc_tls_server_t *crd)
>         return;
> 
>     crd->ops->destroy(crd);
>-    vlc_objres_clear(VLC_OBJECT(crd));
>     vlc_object_delete(crd);
> }
> 
>@@ -129,7 +128,6 @@ void vlc_tls_ClientDelete(vlc_tls_client_t *crd)
>         return;
> 
>     crd->ops->destroy(crd);
>-    vlc_objres_clear(VLC_OBJECT(crd));
>     vlc_object_delete(crd);
> }
> 
>diff --git a/src/video_output/display.c b/src/video_output/display.c
>index 76d49ee240d..db83ee74a43 100644
>--- a/src/video_output/display.c
>+++ b/src/video_output/display.c
>@@ -785,7 +785,6 @@ vout_display_t *vout_display_New(vlc_object_t
>*parent,
>     if (VoutDisplayCreateRender(vd)) {
>         if (vd->close != NULL)
>             vd->close(vd);
>-        vlc_objres_clear(VLC_OBJECT(vd));
>         video_format_Clean(&vd->fmt);
>         goto error;
>     }
>@@ -814,7 +813,6 @@ void vout_display_Delete(vout_display_t *vd)
> 
>     if (vd->close != NULL)
>         vd->close(vd);
>-    vlc_objres_clear(VLC_OBJECT(vd));
> 
>     video_format_Clean(&vd->source);
>     video_format_Clean(&vd->fmt);
>diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c
>index 9d207ac7095..9f615f9c0cd 100644
>--- a/src/video_output/opengl.c
>+++ b/src/video_output/opengl.c
>@@ -105,7 +105,6 @@ void vlc_gl_Release(vlc_gl_t *gl)
> 
>     if (gl->destroy != NULL)
>         gl->destroy(gl);
>-    vlc_objres_clear(VLC_OBJECT(gl));
>     vlc_object_delete(gl);
> }
> 
>diff --git a/src/video_output/window.c b/src/video_output/window.c
>index 16ebf9ef5a2..aeab072ce6c 100644
>--- a/src/video_output/window.c
>+++ b/src/video_output/window.c
>@@ -140,7 +140,6 @@ void vout_window_Delete(vout_window_t *window)
>     if (window->ops->destroy != NULL)
>         window->ops->destroy(window);
> 
>-    vlc_objres_clear(VLC_OBJECT(window));
>     vlc_mutex_destroy(&w->lock);
>     vlc_object_delete(window);
> }
>-- 
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200127/78d6561d/attachment.html>


More information about the vlc-devel mailing list