[vlc-devel] [Patch] Moving some libvlc objects to vlc_objects

Rémi Denis-Courmont remi at remlab.net
Sat Feb 6 14:57:39 CET 2010


Le samedi 6 février 2010 15:37:28 Hugo Beauzee-Luyssen, vous avez écrit :
> 2010/2/6 Rémi Denis-Courmont <remi at remlab.net>:
> > Le samedi 6 février 2010 15:11:42 Hugo Beauzee-Luyssen, vous avez écrit :
> >> Recent libvlc_media_player modification broke something.
> >> If i'm not mistaking, two refcounters were used : one in the
> >> libvlc_internal instance, which is a vlc_object AFAIK, and one on the
> >> libvlc_instance_t.
> >
> > Yes. That said, I don't really understand why the libvlc instance needs
> > counted references at all.
> 
> With the actual system, to perform some cleanings, but I didn't look
> very deep on this part.
> 
> > The LibVLC apps should perform life cycle
> > management by themselves. Some but not many libraries follow the LibVLC
> > pattern here.
> >
> >> Obiously, having two refcounter for the same thing is a problem.
> >
> > Why?
> 
> Because one will reach 0 while the other don't, thus trying to destroy
> libvlc instance while it's still used.

I fail to see the causal link here.

The LibVLC instance references are added up as a single reference from LibVLC 
to the VLC object. When the LibVLC instance reference counter drops to zero 
the reference from LibVLC to the VLC object is removed.

> >> I don't think these patch are perfects, but that should be a start, so
> >> don't hesitate to review and comment !
> >
> > I don't understand what you're trying to fix.
> 
> This :
> vlmc: ../../src/misc/objects.c:585: __vlc_object_release: Assertion
> `internals->first == ((void *)0)' failed.
> #0  0x00007ffff5692035 in raise () from /lib/libc.so.6
> #1  0x00007ffff5693460 in abort () from /lib/libc.so.6
> #2  0x00007ffff568b151 in __assert_fail () from /lib/libc.so.6
> #3  0x00007ffff61fddcc in __vlc_object_release (p_this=0x9dacd8) at
> ../../src/misc/objects.c:585
> #4  0x00007ffff617b550 in libvlc_InternalDestroy (p_libvlc=0x9dacd8)
> at ../../src/libvlc.c:1081
> #5  0x00007ffff645118e in libvlc_release (p_instance=0x8f9770) at
> ../../src/control/core.c:147
> #6  0x00007ffff645773e in libvlc_event_manager_release (p_em=0xd71fb0)
> at ../../src/control/event.c:120
> #7  0x00007ffff64591a8 in libvlc_media_player_destroy (p_mi=0xd71428)
> at ../../src/control/media_player.c:466
> [...]

Looking at the backtrace, you're probably trying to destroy the LibVLC 
instance while you still have a media player object attached to it. That's 
just an ordering bug in libvlc_media_player_destroy().

Changing the reference counting system would not fix that problem.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list