Re: PATCH: 01-typelib.diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 03, 2002 at 09:25:11PM +0100, Marcus Meissner wrote:
> Hi,
> 
> Malte Starostik submitted this patch to wine-patches on
> "Sat Oct 13 2001 - 08:11:00 EDT".
> 
> While not 100% correct, it fixes a very unfunny problem with a typelib
> using program I have, so please apply. :)
> 
> His mail (http://www.winehq.com/hypermail/wine-patches/2001/10/0086.html)
> > This makes sure the ITypeLib held by ITypeInfo isn't destroyed before
> > the type info is, as happened in reaktivate. There, the IProvideClassInfo
> > interface of the loaded control would load the type lib, release it and
> > then the returned ITypeInfo referenced this freed typelib.
> > 
> > However, now the type lib isn't freed at all, which seems to me to be caused 
> > by ITypeInfoImpl's reflist never being freed, and therefore the ITypeLibs 
> > referenced there are not released. I don't grok enough of this code to check 
> > where that should be done properly though :(
> 
> Ciao, Marcus
> 

And actually I should migrate the compile errors back into the patch before
submitting.

Ciao, Marcus
Changelog:
	Malte Starostik <malte@kde.org>
	Do not destroy ITypeLib held by ITypeInfo before the latter is
	freed.

Index: typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.61
diff -u -r1.61 typelib.c
--- typelib.c	2002/01/29 17:05:11	1.61
+++ typelib.c	2002/02/03 18:38:45
@@ -1739,6 +1744,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");
@@ -2883,6 +2888,7 @@
       }
       *ppTypeInfoImpl = (ITypeInfoImpl*)ITypeInfo_Constructor();
       (*ppTypeInfoImpl)->pTypeLib = pTypeLibImpl;
+	  ITypeLib2_AddRef((ITypeLib2 *)pTypeLibImpl);
       (*ppTypeInfoImpl)->index = i;
       (*ppTypeInfoImpl)->Name = TLB_MultiByteToBSTR(
 					     pOtherTypeInfoBlks[i].name_offs +
@@ -4217,7 +4257,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;
@@ -4256,6 +4296,8 @@
 		    result = ITypeLib2_GetTypeInfo(pTLib, pRefType->index,
 						   ppTInfo);
 	    }
+	    if (pTLib != NULL)
+		ITypeLib2_Release(pTLib);
 	}
     }
 



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux