12 Jun
2024
12 Jun
'24
5:22 p.m.
Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/texture.c:
+ else + { + *texture = tex; + IDirect3DTexture9_AddRef(tex); }
if (srcinfo) *srcinfo = imginfo; +exit: + if (buf_tex) + IDirect3DTexture9_Release(buf_tex); + if (tex) + IDirect3DTexture9_Release(tex);
- return D3D_OK; + return hr; This is fine. I wonder, though, if it wouldn't be nicer to keep a separate path for the error case and avoid those `AddRef()`s. Something like:
return hr;
err:
if (buf_tex)
IDirect3DTexture9_Release(buf_tex);
if (tex)
IDirect3DTexture9_Release(tex);
return hr;
This would require duplicating the `d3dx_image_cleanup(&image);` in both exit paths in the next patch, but maybe that's still nicer overall? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5801#note_72982