<div class="gmail_quote">On Mon, Feb 1, 2010 at 12:36 PM, Laurent Aimar <span dir="ltr"><<a href="mailto:fenrir@via.ecp.fr">fenrir@via.ecp.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
On Mon, Feb 01, 2010, Jakob Leben wrote:<br>
>    Hi all!<br>
><br>
> +void input_item_BeginAddSubItems( input_item_t *p_item )<br>
> +{<br>
> +  vlc_event_t event;<br>
> +  event.type = vlc_InputItemBeginAddSubItems;<br>
> +  vlc_event_send( &p_item->event_manager, &event );<br>
> +}<br>
> +<br>
> +void input_item_EndAddSubItems( input_item_t *p_item )<br>
> +{<br>
> +  vlc_event_t event;<br>
> +  event.type = vlc_InputItemEndAddSubItems;<br>
> +  vlc_event_send( &p_item->event_manager, &event );<br>
> +}<br>
 Why are they needed ?<br>
 They are a call to future bugs (way too easy to forget them<br>
or to break when moving arround code).<br></blockquote><div><br>Yes, I am aware of that. The point is, if we are in flat mode so we do delete the parent when it gets sub items, we can not do that just on first created sub-item, because we still have to listen to vlc_InputItemAddSubItems event. So we have to delete and clear references to it _after_ it has created all sub-items. But how do we know when is after? That is why at least the InputItemEndAddSubItems was needed.<br>
<br>Another idea was to have an event that reports for all the new children together, so modules should create an array and pass that in the event. That demanded much more work on the side of the modules, so I went the way I did for simplicity. You are right, simplicity is not the best argument.<br>
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> 
I am a bit suspucious about the locking but I haven't really checked it.<br></blockquote><div><br>Hmm, yes, right, I am suspicious too on second thought... I shall improve that.<br><br>Best regards<br></div></div>