<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 12:13 AM, Stefan Dösinger <span dir="ltr"><<a target="_blank" href="mailto:stefandoesinger@gmail.com">stefandoesinger@gmail.com</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span class="gmail-">On 2016-07-19 19:08, Aaryaman Vasishta wrote:<br>
> +    memset(&mat, 0, sizeof(mat));<br>
> +    mat.dwSize = sizeof(mat);<br>
> +    mat.diffuse.r = RGBA_GETRED(color) / 255.0f;<br>
> +    mat.diffuse.g = RGBA_GETGREEN(color) / 255.0f;<br>
> +    mat.diffuse.b = RGBA_GETBLUE(color) / 255.0f;<br>
> +    mat.diffuse.a = RGBA_GETALPHA(color) / 255.0f;<br>
</span>Doing this here seems questionable. What happens if the camera's background is changed after the viewport is created? You'll probably want to update the material property in viewport::clear(), or maybe in camera::SetSceneBackground.<br></blockquote><div>Right, that'll be added in the implementation of Clear. The camera frame itself doesn't contain a reference to the viewport so I doubt SetSceneBackground has any effect on it. (See the tests I wrote for Clear). <br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<span class="gmail-"><br>
> +    if (material)<br>
> +        IDirect3DMaterial_Release(material);<br>
</span>This will destroy the material, viewport::SetBackground doesn't addref it.<br></blockquote><div>Right, henri suggested the same. I'll move this outside the cleanup label. </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<span class="gmail-"><br>
> +    IDirect3DRMDevice3_Release(device3);<br>
> +    IDirect3DRMDevice_Release(device1);<br>
> +    ref4 = get_refcount((IUnknown *)d3drm1);<br>
> +    todo_wine ok(ref4 > initial_ref1, "Expected ref4 > initial_ref1, got initial_ref1 = %u, ref4 = %u.\n", initial_ref1, ref4);<br>
</span>The ref4 > inital_ref1 check isn't all too surprising because frame3 still holds a reference to its d3drm parent. Though it seems the leaked reference added by the second Viewport::Init call gets released somewhere. The test doesn't exactly show where. It is possible that releasing the device frees it, or releasing the frame does it.<br></blockquote><div>The leaked references created by the second Init call are all released when the device is destroyed. This suggests that the device is using some sort of destroy callback and keeping track of all leaked references. See the ref4 == initial_ref1 test below it.<br><br></div><div>I'll resend the patch with the fixes you mentioned. Thanks for the review!<br><br></div><div>Cheers,<br></div><div>Aaryaman<br> </div></div><br></div></div>