On Sat, 24 Nov 2001 lawson_whitney@juno.com wrote:
Anyone like to take a swat at this?
I've explained it before on this list - you need to apply a typelib refcounting patch, and there is one by Malte somewhere in the wine-patches archives. But since you ask, here is the refcounting pieces of the patch we use in WineX:
Index: typelib.c =================================================================== RCS file: /cvsroot/winex/wine/dlls/oleaut32/typelib.c,v retrieving revision 1.1.1.17 diff -u -r1.1.1.17 typelib.c --- typelib.c 2001/10/28 14:14:58 1.1.1.17 +++ typelib.c 2001/11/25 09:05:56 @@ -1739,6 +1743,7 @@ pcx->pTblDir->pTypeInfoTab.offset+count*sizeof(tiBase)); /* this is where we are coming from */ ptiRet->pTypeLib = pLibInfo; + ITypeLib2_AddRef((ITypeLib2 *)pLibInfo); ptiRet->index=count; /* fill in the typeattr fields */ FIXME("Assign constructor/destructor memid\n"); @@ -2876,6 +2881,7 @@ } *ppTypeInfoImpl = (ITypeInfoImpl*)ITypeInfo_Constructor(); (*ppTypeInfoImpl)->pTypeLib = pTypeLibImpl; + ITypeLib2_AddRef((ITypeLib2 *)pTypeLibImpl); (*ppTypeInfoImpl)->index = i; (*ppTypeInfoImpl)->Name = TLB_MultiByteToBSTR( pOtherTypeInfoBlks[i].name_offs + @@ -4198,7 +4204,7 @@ if(!pRefType) FIXME("Can't find pRefType for ref %lx\n", hRefType); if(pRefType && hRefType != -1) { - ITypeLib *pTLib; + ITypeLib *pTLib = NULL;
if(pRefType->pImpTLInfo == TLB_REF_INTERNAL) { int Index; @@ -4237,6 +4243,8 @@ result = ITypeLib2_GetTypeInfo(pTLib, pRefType->index, ppTInfo); } + if (pTLib != NULL) + ITypeLib2_Release(pTLib); } }