[D3D9] fix for SetFVF memleak [2nd try+patch]

Stefan Dösinger stefandoesinger at gmx.at
Sun Oct 15 05:12:50 CDT 2006

> -> SetFVF()... sets FVF
> -> GetVertexDeclaration() ... vdecl is null, but there is an FVF, grab
> the FVF, and make a declaration out of it. Store the declaration, and
> return it to the caller with refcount 1.
> -> GetVertexDeclaration() again - just grab the stored declaration and
> follow regular code path, increasing the refcount.
> Now, if the caller does not release the ref, it will leak memory [
> because d3d certainly doesn't free it - not on SetFVF, or on
> SetVertexDecl ]. On the other hand, if the caller does release it, will
> it cause damage (1) on subsequent get calls? (2) at draw time... and how
> can we test that.
3 tests I can think of:

* If you release the decl, does GetVertexDecl return a different pointer?
* If you call SetFVF with a different FVF, do you get a different decl 
* If you call SetFVF, GetVertexDecl and AddRef the decl, then SetFVF again 
with a different FVF, does the refcount of the previously returned 
declaration change? What happens if you allocate a huge amount of memory and 
fill it with garbage? Can you still access the vertex declaration?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20061015/55a630ac/attachment.pgp

More information about the wine-devel mailing list