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

Ivan Gyurdiev ivg231 at gmail.com
Sat Oct 14 01:46:49 CDT 2006

Ivan Gyurdiev wrote:
> Ivan Gyurdiev wrote:
>> Karsten Elfenbein wrote:
>>> * don't prevent IUnknown_Release of pDecl in the exit section and fix
>>> for http://bugs.winehq.org/show_bug.cgi?id=5656
>> This seems wrong, d3d9 does not keep an internal reference of the vdecl.
>> Try the attached patch instead, let me know if it works...
> ...better yet, try this one
Based on further tests, I don't believe this patch is correct.. but it 
will fix the memory leak. I'm still unsure what kind of insanity the 
native API is doing internally - in process of figuring that out. When 
adding this code, I spent a lot of time testing conversion between the 
fvf and decl, and that has been shown to be correct - but management of 
the decl afterwards seems rather wrong to me now, and that it needs 
additional tests.

Tests Show: Refcount of converted decl is 1 after GetVertexDeclaration()
Tests Show: Refcount of converted decl *remains* 1 over a SetFVF call
Tests Show: Refcount of converted decl *remains* 1 over a 
SetVertexDeclaration(NULL) call

I currently suspect that the convertedDecl is shared internally, and 
refcount behavior does not follow normal code path on Get(). Another 
possibility is that the internal storage is FVF-based, and conversions 
are ran in the GetVertexDecl() code [ or the object is cloned ]... but 
other tests show this not to be the case.

More information about the wine-devel mailing list