[vlc-devel] commit: Qt4: store input_item_t* in plitem and handle metadata in model ( Ilkka Ollakka )

Pierre d'Herbemont pdherbemont at gmail.com
Fri Aug 14 11:11:58 CEST 2009

On Aug 13, 2009, at 11:52 PM, Jakob Leben wrote:

> Now if the other thread simply deleted some items and we have  
> reference counting, our pointers to them would still be valid.

You are right.

> But imagine that in the time when we don't hold the lock the other  
> thread adds a child to the playlist item, so changes it's  
> pp_children field, but then unreferences both the item and its new  
> child, before we could add a reference to the child! The former item  
> will still exist as we had a reference to it, but with wrong  
> reference to a child that got already deleted, as we didn't add a  
> reference for it.

That's one of the weakness of the playlist. However, this won't happen  
as playlist_item are only freed when the playlist is freed. See src/ 

int playlist_ItemRelease( playlist_item_t *p_item )
	/* For the assert */
	playlist_t *p_playlist = p_item->p_playlist;

	/* Surprise, we can't actually do more because we
	* don't do refcounting, or eauivalent.
	* Because item are not only accessed by their id
	* using playlist_item outside the PL_LOCK isn't safe.
	* modules do that.
	* Who wants to add proper memory management? */
	uninstall_input_item_observer( p_item );
	ARRAY_APPEND( pl_priv(p_playlist)->items_to_delete, p_item);
	return VLC_SUCCESS;


More information about the vlc-devel mailing list