Robert Shearman : oleaut32: Free the connection points on destruction of the font object.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 14 07:27:52 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 1891e137da05777f670880a19d82ee2cd87f7e83
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=1891e137da05777f670880a19d82ee2cd87f7e83

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Feb 14 11:33:18 2006 +0100

oleaut32: Free the connection points on destruction of the font object.
Free the connection points on destruction of the font object and cope
with failure of CreateConnectionPoint on construction.

---

 dlls/oleaut32/olefont.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index 2a121cc..b213f50 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -511,8 +511,18 @@ static OLEFontImpl* OLEFontImpl_Construc
   newObject->fontLock = 0;
   newObject->cyLogical  = 72L;
   newObject->cyHimetric = 2540L;
+  newObject->pPropertyNotifyCP = NULL;
+  newObject->pFontEventsCP = NULL;
+
   CreateConnectionPoint((IUnknown*)newObject, &IID_IPropertyNotifySink, &newObject->pPropertyNotifyCP);
   CreateConnectionPoint((IUnknown*)newObject, &IID_IFontEventsDisp, &newObject->pFontEventsCP);
+
+  if (!newObject->pPropertyNotifyCP || !newObject->pFontEventsCP)
+  {
+    OLEFontImpl_Destroy(newObject);
+    return NULL;
+  }
+
   TRACE("returning %p\n", newObject);
   return newObject;
 }
@@ -533,6 +543,11 @@ static void OLEFontImpl_Destroy(OLEFontI
   if (fontDesc->gdiFont!=0)
     DeleteObject(fontDesc->gdiFont);
 
+  if (fontDesc->pPropertyNotifyCP)
+      IConnectionPoint_Release(fontDesc->pPropertyNotifyCP);
+  if (fontDesc->pFontEventsCP)
+      IConnectionPoint_Release(fontDesc->pFontEventsCP);
+
   HeapFree(GetProcessHeap(), 0, fontDesc);
 }
 




More information about the wine-cvs mailing list