[vlc-devel] commit: Qt4: store input_item_t* in plitem and handle metadata in model ( Ilkka Ollakka )
remi at remlab.net
Fri Aug 14 15:45:26 CEST 2009
On Fri, 14 Aug 2009 14:54:22 +0200, Jakob Leben <jakob.leben at gmail.com>
> I think you both didn't realize the subtle problem that I tried to
> Assumption 1: when a thread receives "item added" callback, it
> doesn't react immediately but only when returning to qt event loop
> (that's how things work right now), so it doesn't immediately rise
> refcount on the new item.
That would be a bug in the Qt4 UI. It needs to increase the reference count
synchronously (in the VLC variable callback).
> 4. Then: we get the lock on the playlist, we have a pointer to the
> parent and have to return data about the child's number of teeth.
> It doesn't help us to hold a lock!
Yes it does. You should not even know that their is a child if you don't
have the playlist lock, so you cannot ask for anything about children
without the playlist lock in the first place.
You can see how this is done for the VLC objects tree. Any operation that
reads (get children of an object, find an object) or writes (attach an
object, detach an object) the tree structure is done under the global
structure lock. There is one special exception: getting the root of the
tree (the LibVLC object) requires no lock because it is a read-only value
throughout. Furthermore, acquiring the structure lock while already locking
an object (ref lock or var lock) is FORBIDDEN to prevent deadlocks.
Just one thing is not yet done quite properly here: getting the parent of
an object would need the structure lock.
More information about the vlc-devel