working together on stdole.tlb and a end to dcom9x

Nyef nyef at
Sat Aug 28 21:56:53 CDT 2004

On Sun, Aug 29, 2004 at 04:42:04AM +0200, Filip Navara wrote:
> You're pretty much right. I tried to create *very* simple 
> HelloWorld-type type library with it and and it reported me bunch of 
> "stub!" messages and crashed. I also found a bug in implementation of 
> ITypeLib2_fnGetTypeInfoOfGuid (in fact both implementations, the one in 
> typelib.c and the second in typelib2.c). It should reference the typelib 
> it's called on. This ensures that later call 
> ITypeInfo_GetContainingTypeLib will not return bogus pointer if the 
> original caller already released the TypeLib. See the attached test. If 
> any COM hacker around can fix it, it would be nice.

You're right to be suspicious, and there may actually be a bug with the
reference counting in typelib2.c, but fnGetTypeInfoOfGuid should -not-
directly AddRef() the containing typelib. Such an AddRef() rightfully
belongs in with the implemetations of QueryInterface(), AddRef(), and
Release() on ICreateTypeInfo2. It is supposed to be set up that the
TypeInfo objects never deallocate themselves when they hit 0 references,
but they do hold a reference to their containing typelib. The TypeLib
objects never hold a reference to any of their typeinfos (so as not to
cause a reference cycle), but they are set up to deallocate the typeinfo
structures when the typelib hits 0 references.

I'll give the typelib2.c code a look-over tomorrow with an eye towards
verifying that reference counting is correct.

> Regards,
> Filip

--Alastair Bridgewater

More information about the wine-devel mailing list