TypeLib containment refcounting

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

 



ChangeLog:
When providing a TypeInfo object, inc/dec the refcount so that programs
don't call GetContainingTypeLib and crash as the container has been
destroyed.


Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.96
diff -u -r1.96 typelib.c
--- dlls/oleaut32/typelib.c	15 May 2003 22:58:17 -0000	1.96
+++ dlls/oleaut32/typelib.c	14 Jun 2003 18:10:07 -0000
@@ -3359,6 +3359,8 @@
 
     *ppTInfo = (ITypeInfo*)pTypeInfo;
     ITypeInfo_AddRef(*ppTInfo);
+    /* the TypeInfo object has a reference to us, so increment our own refcount */
+    ITypeLib2_AddRef(iface);
     return S_OK;
 }
 
@@ -3833,6 +3835,8 @@
       {
         ITypeInfo_Release((ITypeInfo*)This->next);
       }
+      /* dec the refcount on the containing typelib */
+      ITypeLib2_Release(This->pTypeLib);
 
       HeapFree(GetProcessHeap(),0,This);
       return 0;
@@ -4793,13 +4797,13 @@
     /* If a pointer is null, we simply ignore it, the ATL in particular passes pIndex as 0 */
     if (pIndex) {
       *pIndex=This->index;
-      TRACE("returning pIndex=%d", *pIndex);
+      TRACE("returning pIndex=%d\n", *pIndex);
     }
     
     if (ppTLib) {
       *ppTLib=(LPTYPELIB )(This->pTypeLib);
       ITypeLib2_AddRef(*ppTLib);
-      TRACE("returning ppTLib=%p", *ppTLib);
+      TRACE("returning ppTLib=%p\n", *ppTLib);
     }
     
     return S_OK;

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

  Powered by Linux