On 11 May 2016 at 16:43, Aaryaman Vasishta jem456.vasishta@gmail.com wrote:
@@ -1152,15 +1156,21 @@ static HRESULT WINAPI d3drm3_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRM static HRESULT WINAPI d3drm3_CreateTexture(IDirect3DRM3 *iface, D3DRMIMAGE *image, IDirect3DRMTexture3 **texture) {
struct d3drm_texture *object; HRESULT hr;
FIXME("iface %p, image %p, texture %p partial stub.\n", iface, image, texture);
- TRACE("iface %p, image %p, texture %p.\n", iface, image, texture);
- if (FAILED(hr = d3drm_texture_create(&object)))
- if (!d3drm_validate_image(image))
return D3DRMERR_BADVALUE;
Why do you need the d3drm_validate_image() call? Purely for the error code?
If CreateTexture fails because of an invalid image, it doesn't leak a reference to d3drm, unlike the InitFrom* calls. So I had to either do this, or explicitly release texture->d3drm if InitFromImage fails.
Cheers, Aaryaman
On Wed, May 11, 2016 at 9:13 PM, Henri Verbeet hverbeet@gmail.com wrote:
On 11 May 2016 at 16:43, Aaryaman Vasishta jem456.vasishta@gmail.com wrote:
@@ -1152,15 +1156,21 @@ static HRESULT WINAPI
d3drm3_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRM
static HRESULT WINAPI d3drm3_CreateTexture(IDirect3DRM3 *iface, D3DRMIMAGE *image, IDirect3DRMTexture3 **texture) {
struct d3drm_texture *object; HRESULT hr;
FIXME("iface %p, image %p, texture %p partial stub.\n", iface,
image, texture);
- TRACE("iface %p, image %p, texture %p.\n", iface, image, texture);
- if (FAILED(hr = d3drm_texture_create(&object)))
- if (!d3drm_validate_image(image))
return D3DRMERR_BADVALUE;
Why do you need the d3drm_validate_image() call? Purely for the error code?
On 11 May 2016 at 17:50, Aaryaman Vasishta jem456.vasishta@gmail.com wrote:
If CreateTexture fails because of an invalid image, it doesn't leak a reference to d3drm, unlike the InitFrom* calls. So I had to either do this, or explicitly release texture->d3drm if InitFromImage fails.
That's not what the implementation in patch 2/6 does. It will leak if the texture is already initialised, but not when d3drm_validate_image() fails.
Right, it's actually for the different return values, sorry to not mention it earlier.
Cheers, Aaryaman
On Wed, May 11, 2016 at 10:16 PM, Henri Verbeet hverbeet@gmail.com wrote:
On 11 May 2016 at 17:50, Aaryaman Vasishta jem456.vasishta@gmail.com wrote:
If CreateTexture fails because of an invalid image, it doesn't leak a reference to d3drm, unlike the InitFrom* calls. So I had to either do
this,
or explicitly release texture->d3drm if InitFromImage fails.
That's not what the implementation in patch 2/6 does. It will leak if the texture is already initialised, but not when d3drm_validate_image() fails.
I just realized I can avoid calling d3drm_validate_image() there by just returning D3DRMERR_BADVALUE if InitFromImage fails. Is that fine?
On Wed, May 11, 2016 at 10:53 PM, Aaryaman Vasishta < jem456.vasishta@gmail.com> wrote:
Right, it's actually for the different return values, sorry to not mention it earlier.
Cheers, Aaryaman
On Wed, May 11, 2016 at 10:16 PM, Henri Verbeet hverbeet@gmail.com wrote:
On 11 May 2016 at 17:50, Aaryaman Vasishta jem456.vasishta@gmail.com wrote:
If CreateTexture fails because of an invalid image, it doesn't leak a reference to d3drm, unlike the InitFrom* calls. So I had to either do
this,
or explicitly release texture->d3drm if InitFromImage fails.
That's not what the implementation in patch 2/6 does. It will leak if the texture is already initialised, but not when d3drm_validate_image() fails.
On 11 May 2016 at 19:25, Aaryaman Vasishta jem456.vasishta@gmail.com wrote:
I just realized I can avoid calling d3drm_validate_image() there by just returning D3DRMERR_BADVALUE if InitFromImage fails. Is that fine?
Yeah.