From 1891e137da05777f670880a19d82ee2cd87f7e83 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Tue, 14 Feb 2006 11:33:18 +0100 Subject: [PATCH] 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 file changed, 15 insertions(+) diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index 2a121ccdbb0..b213f501f68 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -511,8 +511,18 @@ static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc) 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(OLEFontImpl* fontDesc) 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); }