From fc78f552a0c5c0f5cccabf2939451c2f61900af1 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 26 Mar 2009 16:41:59 +0000 Subject: [PATCH] ole32: AddRef does not return an HRESULT. Have the constructor create the object with one reference. --- dlls/ole32/clipboard.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index 7d1bb263f2d..9815749c944 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -322,13 +322,8 @@ static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Clone return E_INVALIDARG; hr = enum_fmtetc_construct(This->countFmt, This->pFmt, ppenum); - if (FAILED(hr)) return hr; - /* FIXME: This is wrong! */ - if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenum))) - return ( hr ); - - return (*ppenum) ? S_OK : E_OUTOFMEMORY; + return hr; } static const IEnumFORMATETCVtbl efvt = @@ -347,7 +342,6 @@ static const IEnumFORMATETCVtbl efvt = * * Creates an IEnumFORMATETC enumerator from an array of FORMATETC * Structures. - * NOTE: this does not AddRef the interface. */ static HRESULT enum_fmtetc_construct(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC **obj) { @@ -358,7 +352,7 @@ static HRESULT enum_fmtetc_construct(UINT cfmt, const FORMATETC afmt[], IEnumFOR ef = HeapAlloc(GetProcessHeap(), 0, sizeof(*ef)); if (!ef) return E_OUTOFMEMORY; - ef->ref = 0; + ef->ref = 1; ef->lpVtbl = &efvt; ef->pos = 0; @@ -1046,12 +1040,6 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc( if (FAILED(hr)) HANDLE_ERROR( hr ); - /* FIXME: This is wrong! */ - if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenumFormatEtc))) - HANDLE_ERROR( hr ); - - hr = S_OK; - CLEANUP: /* * Free the array of FORMATETC's