d3dx9_36/tests [patch 2/2, try 3]: Add tests for D3DXCreatePolygon

Rico Schüller kgbricola at web.de
Wed Nov 9 13:11:23 CST 2011

Am 09.11.2011 14:42, schrieb Matteo Bruni:
> 2011/11/9 David Adam<david.adam.cnrs at gmail.com>:
> Better, but there are still issues:
> +    if( polygon ) polygon->lpVtbl->Release(polygon);
> +    if( ppBuffer ) ID3DXBuffer_Release(ppBuffer);
> You aren't setting those pointers to NULL (and your test shows that
> D3DXCreatePolygon doesn't touch them when the call fails), so those
> ifs actually are protecting nothing.
> In patch 1/2, LockVertex/IndexBuffer should not fail in normal
> circumstances, so it's probably better to use ERR instead of TRACE
> there.
> Also, please, try to fixup the code style. E.g. the preferred style
> for 'if's and loops is to have a whitespace between the keyword and
> the '(' and no whitespace between the parentheses and the condition.
> Stick with that. Don't use hungarian notation (ppBuffer ...), fix
> whitespaces around operators, etc

+    ref = polygon->lpVtbl->AddRef(polygon);
+    ok(ref == 2, "Expected refcount = 2, received %d", ref);

Let me add one point. I don't see a reason why you'd check AddRef here. 
It just increase the refcount for the polygon, if you don't call Release 
a second time the memory will be lost. You may check ref = 
IDirect3DDevice9_Release(device); that way you should see, how many 
resources you leak (only works for objects which hold a device reference).


More information about the wine-devel mailing list