[dx9-16] Basetexture support

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Mon Dec 6 14:02:35 CST 2004


>The ref-counting in this patch looks a bit suspicious. Does 
>This->resource.parent point to an object that holds a ref-count on the 
>IWineD3DBaseTextureImpl object? If so, then that would lead to a 
>circular ref-count where neither object would be freed.

Yes, but I think its ok (there is a minor problem with that patch and the
GetParent call, which I'll fix in the next patch if I confirm it). 

I have had huge problems with the double ref counting (see discussions
around earlier patch 12!) but I think I have got it about right now. 

Basically there is a d3d9 basetexture which contains a ref to the wined3d
basetexture (same as index and vertex buffer). When d3d9 is released and
reaches 0, it releases the wined3d object. Its set up initially with a ref
count of 1 for both COM objects. I cant set the ref count of the d3d9 one up
by one for the pointer held in the parent location specifically because of
the circular reference issue.

If the wined3d specific one is addref'd, then it addref's the parent, and
vica versa for release.

So to sum up, I believe the current ref counting and this patch to be
correct - let me know if there's a problem with it

Jason





More information about the wine-devel mailing list