[vlc-devel] [vlc-commits] modules: store object name in a variable

Rémi Denis-Courmont remi at remlab.net
Mon Mar 4 21:51:31 CET 2019


Le maanantaina 4. maaliskuuta 2019, 18.39.59 EET Thomas Guillem a écrit :
> On Mon, Mar 4, 2019, at 17:30, Rémi Denis-Courmont wrote:
> > vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar
> > 4 18:18:46 2019 +0200| [38545d874a4952eada17b3dfe07b793cbaa705fd] |
> > committer: Rémi Denis-Courmont
> > 
> > modules: store object name in a variable
> 
> Thanks a lot for adding the module name back.
> 
> > > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=38545d874a4952ead
> > > a17b3dfe07b793cbaa705fd> 
> > ---
> > 
> >  src/modules/modules.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/modules/modules.c b/src/modules/modules.c
> > index 9c3ce314c4..6d493e5e31 100644
> > --- a/src/modules/modules.c
> > +++ b/src/modules/modules.c
> > @@ -332,13 +332,20 @@ static void generic_stop(void *func, va_list ap)
> > 
> >  module_t *module_need(vlc_object_t *obj, const char *cap, const char
> >  *name,
> >  
> >                        bool strict)
> >  
> >  {
> > 
> > -    return vlc_module_load(obj, cap, name, strict, generic_start, obj);
> > +    module_t *module = vlc_module_load(obj, cap, name, strict,
> > +                                       generic_start, obj);
> > +    if (module != NULL) {
> > +        var_Create(obj, "module-name", VLC_VAR_STRING);
> > +        var_SetString(obj, "module-name", module_get_object(module));
> > +    }
> 
> Why not putting that in vlc_module_load ?
> 
> I could be very useful for us to know

Yes. It would be very convenient for certain use cases. But you know what they 
say about when something looks too good to be true.

The object name feature does not work, never worked in the nearly 12 years 
that it has been forced into the code base without review, and never will, 
because it is too generic to be actually feasible.

There are no ways to know when wait and when to query children objects, and 
when to query object properties for objects that you literally have zero 
informations about. That was true 11 years ago when the fatal flaws hit users 
and the scope of the misdesign realized, that was true 9 years ago when the 
feature was deprecated, and it was still true two days ago.

Decreeing that discussions older than 3 is irrelevant is ridiculous. 
Especially when it flies in the face of outstanding code comments and git 
history.

Besides enumerating children is even more broken, since there is basically 
nothing safe you can do with an object belonging to another thread which you 
got without context. Well, you can print its address, but then even releasing 
the object is iffy.

How useful is that...

-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the vlc-devel mailing list