TypeLib containment refcounting

Mike Hearn mike at theoretic.com
Mon Jun 16 14:28:20 CDT 2003

> This doesn't look right, you increment the refcount on every GetTypeInfo
> but only decrement when the typeinfo object is destroyed.

Well, unless you can call GetTypeInfoOfGuid twice and get two pointers to
the same interface (maybe you can, i don't really know but that would seem
unusual), I don't understand why this is wrong. When somebody calls
GetTypeInfoOfGuid they get an interface, so at some point they should
release it, which will in turn release the reference to the typelib.
Without this patch, an app did a GetTypeInfo, released the typelib object
and then tried to get the container from ITypeInfo which obviously crashed
when it tried to do an AddRef on the destroyed object.

Otherwise I don't really understand how this should work, unless you
manually add a reference for every type info object when the typelib is
first constructed, then manually release also for every object. That would
seem a bit odd though, to me.

Could you or somebody else explain how this should work?

thanks -mike

More information about the wine-devel mailing list