<div dir="ltr">Hi,<br><div><div><div class="gmail_extra"><div class="gmail_quote"><br>On Sun, Aug 7, 2016 at 3:42 AM, Stefan Dösinger <span dir="ltr"><<a href="mailto:stefandoesinger@gmail.com" target="_blank">stefandoesinger@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2016-08-06 16:29, Aaryaman Vasishta wrote:<br>
> +    while (!done)<br>
> +    {<br>
> +        if (FAILED(hr = IDirect3DRMFrame3_GetParent(<wbr>frame, &parent_frame)))<br>
> +            return hr;<br>
> +        if (parent_frame)<br>
> +        {<br>
> +            frame = parent_frame;<br>
> +            IDirect3DRMFrame3_Release(<wbr>parent_frame);<br>
> +        }<br>
> +        else<br>
> +            done = TRUE;<br>
> +    }<br>
</span>What happens if GetScene is called on the root frame? Does it return itself or NULL or an error?<br></blockquote><div>It returns itself. I'll add the test in the resend. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
You can eliminate the done variable from this loop by replacing it with a break:<br>
<br>
for (;;)<br>
{<br>
<span class="">    if (FAILED(hr = IDirect3DRMFrame3_GetParent(<wbr>frame, &parent_frame)))<br>
</span>        return hr;<br>
    if (parent_frame)<br>
    {<br>
        frame = parent_frame;<br>
        IDirect3DRMFrame3_Release(<wbr>parent_frame);<br>
    }<br>
    else<br>
        break;<br>
}<br>
<br>
I originally thought about a do {} while(parent_frame); kind of construct but that doesn't gain you much because you need the if check anyway to release parent_frame.<br>
<br>
It's not nice to call GetParent in the next iteration after you release the frame, but so far I haven't come up with an implementation that avoids that and isn't terribly ugly. I'll keep thinking.<br></blockquote><div>Makes sense. You're right about the way I'm releasing parent_frame being a bit odd when you look at it. But going in terms of refcounts (and the fact that all frame versions share the same refcount) there shouldn't be an issue for now.<br><br></div><div>Thanks for the review :)<br><br><br></div><div>Cheers,<br></div><div>Aaryaman <br></div></div><br></div></div></div></div>