Commit 1891e137 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

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.
parent 9030ff2c
...@@ -511,8 +511,18 @@ static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc) ...@@ -511,8 +511,18 @@ static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc)
newObject->fontLock = 0; newObject->fontLock = 0;
newObject->cyLogical = 72L; newObject->cyLogical = 72L;
newObject->cyHimetric = 2540L; newObject->cyHimetric = 2540L;
newObject->pPropertyNotifyCP = NULL;
newObject->pFontEventsCP = NULL;
CreateConnectionPoint((IUnknown*)newObject, &IID_IPropertyNotifySink, &newObject->pPropertyNotifyCP); CreateConnectionPoint((IUnknown*)newObject, &IID_IPropertyNotifySink, &newObject->pPropertyNotifyCP);
CreateConnectionPoint((IUnknown*)newObject, &IID_IFontEventsDisp, &newObject->pFontEventsCP); CreateConnectionPoint((IUnknown*)newObject, &IID_IFontEventsDisp, &newObject->pFontEventsCP);
if (!newObject->pPropertyNotifyCP || !newObject->pFontEventsCP)
{
OLEFontImpl_Destroy(newObject);
return NULL;
}
TRACE("returning %p\n", newObject); TRACE("returning %p\n", newObject);
return newObject; return newObject;
} }
...@@ -533,6 +543,11 @@ static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc) ...@@ -533,6 +543,11 @@ static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc)
if (fontDesc->gdiFont!=0) if (fontDesc->gdiFont!=0)
DeleteObject(fontDesc->gdiFont); DeleteObject(fontDesc->gdiFont);
if (fontDesc->pPropertyNotifyCP)
IConnectionPoint_Release(fontDesc->pPropertyNotifyCP);
if (fontDesc->pFontEventsCP)
IConnectionPoint_Release(fontDesc->pFontEventsCP);
HeapFree(GetProcessHeap(), 0, fontDesc); HeapFree(GetProcessHeap(), 0, fontDesc);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment