H. Verbeet wrote:
On 14/10/06, Ivan Gyurdiev ivg231@gmail.com wrote:
Ivan Gyurdiev wrote:
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
That's what happens with regular declarations as well, see test_get_set_vertex_declaration() in the d3d9 vertexdeclaration tests. Calling SetVertexDeclaration() doesn't change the refcount, but calling GetVertexDeclaration does (however, note that wined3d internally does change refcounts).
Exactly... so why is the refcount 1 *after* GetVertexDeclaration.
What does GetVertexDeclaration() do for the generated decl?
I don't think it increases the refcount like it does normally.