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.
This commit is contained in:
Robert Shearman 2006-02-14 11:33:18 +01:00 committed by Alexandre Julliard
parent 9030ff2c13
commit 1891e137da
1 changed files with 15 additions and 0 deletions

View File

@ -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);
}