Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/filemoniker.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-)
diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c index d7c2a5a5ea7..d3940a9365f 100644 --- a/dlls/ole32/filemoniker.c +++ b/dlls/ole32/filemoniker.c @@ -59,7 +59,6 @@ static inline FileMonikerImpl *impl_from_IROTData(IROTData *iface)
/* Local function used by filemoniker implementation */ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName); -static HRESULT FileMonikerImpl_Destroy(FileMonikerImpl* iface);
/******************************************************************************* * FileMoniker_QueryInterface @@ -116,21 +115,19 @@ FileMonikerImpl_AddRef(IMoniker* iface) return InterlockedIncrement(&This->ref); }
-/****************************************************************************** - * FileMoniker_Release - */ -static ULONG WINAPI -FileMonikerImpl_Release(IMoniker* iface) +static ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface) { - FileMonikerImpl *This = impl_from_IMoniker(iface); - ULONG ref; - - TRACE("(%p)\n",iface); + FileMonikerImpl *moniker = impl_from_IMoniker(iface); + ULONG ref = InterlockedDecrement(&moniker->ref);
- ref = InterlockedDecrement(&This->ref); + TRACE("(%p, refcount %d)\n", iface, ref);
- /* destroy the object if there are no more references to it */ - if (ref == 0) FileMonikerImpl_Destroy(This); + if (!ref) + { + if (moniker->pMarshal) IUnknown_Release(moniker->pMarshal); + HeapFree(GetProcessHeap(), 0, moniker->filePathName); + HeapFree(GetProcessHeap(), 0, moniker); + }
return ref; } @@ -452,20 +449,6 @@ FileMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize) return S_OK; }
-/****************************************************************************** - * FileMoniker_Destroy (local function) - *******************************************************************************/ -HRESULT FileMonikerImpl_Destroy(FileMonikerImpl* This) -{ - TRACE("(%p)\n",This); - - if (This->pMarshal) IUnknown_Release(This->pMarshal); - HeapFree(GetProcessHeap(),0,This->filePathName); - HeapFree(GetProcessHeap(),0,This); - - return S_OK; -} - /****************************************************************************** * FileMoniker_BindToObject */