"Ann and Jason Edmeades" us@the-edmeades.demon.co.uk writes:
I have changed the design so only the Direct3D<interface><8/9> ones extend IUnknown, and so there is no reference counting of the IWineD3D objects.
I don't think that's a good idea. If you are using COM interfaces then you need to use them the COM way, this means IWineD3D should derive from IUnknown and freeing it should be done through the Release method. If you don't want to use standard COM then don't declare COM interfaces at all, create your own mechanism.
Instead, when any Direct3D<interface><8/9> is Released to zero, then it calls a Free method in its WineD3D equivalent interface. I also changed the IWineD3D interface to contain, as a void *, a pointer to its 'parent' (by which I mean the Direct3D8/9 interface) plus a function (GetParent) which returns that pointer.
This is bad too, you shouldn't use void*, you should use proper types, at the very least IUnknown*, but preferably define an IWineD3DUser interface or something like that.