<div dir="ltr"><div>On Fri, Apr 29, 2016 at 12:56 PM, Stefan Dösinger <span dir="ltr"><<a href="mailto:stefandoesinger@gmail.com" target="_blank">stefandoesinger@gmail.com</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
> Am 28.04.2016 um 20:17 schrieb Aaryaman Vasishta <<a href="mailto:jem456.vasishta@gmail.com">jem456.vasishta@gmail.com</a>>:<br>
><br>
> +    if (texture->d3drm && texture->initialized)<br>
> +        IDirect3DRM_Release(texture->d3drm);<br>
</span>I thought the idea was to use AddDestroyCallback instead of a flag to control the Release call. Do I remember this incorrectly, or what's the reason for going back to a flag?<br>
<br>
Also, what's the difference between image != NULL and initialized? Or, in a later stage when you have initFromTexture or what it is called, image != NULL || ddraw_texture != NULL?<br></blockquote>AddDestroyCallback would be used to destroy the image struct, which will be used when InitFromFile will be implemented. Since the image here is provided by the application, there wasn't any need to use a destroy callback right now.</div><div class="gmail_quote"><br></div><div class="gmail_quote">texture->initialized is only used to indicate whether InitFrom* was called on texture or not. As you can see from the tests, d3drm AddRef's IDirect3DRM only after InitFrom* is called. (I had initially thought that CreateObject would do that, but the tests say otherwise).</div><div class="gmail_quote"><br></div><div class="gmail_quote">Since we needed the reference to IDirect3DRM when AddRefing it during the InitFrom* calls, I decided to initialize texture->d3drm at CreateObject without AddRefing it there. So if someone decides to release a texture created using CreateObject but not initialized using InitFrom*, the texture->initialized member will prevent d3drm from releasing texture->d3drm.<br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><br>
>  IDirect3DRM_AddRef(texture->d3drm);<br>
> +<br>
> +    if (texture->image)<br>
> +        return D3DRMERR_BADOBJECT;<br>
</span>Afair  the ref leak here is intentional. If it is, I think it's worth adding a comment.<br></blockquote><div>Right, I will add comments above the related test as well.</div><div><br></div><div>Cheers,</div><div>Aaryaman</div></div><br></div></div>