ole32: Make proxy_manager_get_remunknown AddRef the return IRemUnknown object.

Fix up the callers to release the returned IRemUnknown object.
This commit is contained in:
Rob Shearman 2007-05-21 16:43:44 +01:00 committed by Alexandre Julliard
parent 5369d4dffd
commit bf2b49b4e0
1 changed files with 13 additions and 2 deletions

View File

@ -283,6 +283,7 @@ static HRESULT WINAPI ClientIdentity_QueryMultipleInterfaces(IMultiQI *iface, UL
{
hr = IRemUnknown_RemQueryInterface(remunk, ipid, NORMALEXTREFS,
nonlocal_mqis, iids, &qiresults);
IRemUnknown_Release(remunk);
if (FAILED(hr))
ERR("IRemUnknown_RemQueryInterface failed with error 0x%08x\n", hr);
}
@ -409,6 +410,7 @@ static HRESULT WINAPI Proxy_MarshalInterface(
rif.cPublicRefs = (mshlflags == MSHLFLAGS_TABLESTRONG) ? 1 : NORMALEXTREFS;
rif.cPrivateRefs = 0;
hr = IRemUnknown_RemAddRef(remunk, 1, &rif, &hrref);
IRemUnknown_Release(remunk);
if (hr == S_OK && hrref == S_OK)
{
/* table-strong marshaling doesn't give the refs to the
@ -467,6 +469,7 @@ static HRESULT WINAPI Proxy_MarshalInterface(
}
else
ERR("IRemUnknown_RemQueryInterface failed with error 0x%08x\n", hr);
IRemUnknown_Release(remunk);
}
}
@ -577,6 +580,7 @@ static HRESULT ifproxy_get_public_ref(struct ifproxy * This)
rif.cPublicRefs = NORMALEXTREFS;
rif.cPrivateRefs = 0;
hr = IRemUnknown_RemAddRef(remunk, 1, &rif, &hrref);
IRemUnknown_Release(remunk);
if (hr == S_OK && hrref == S_OK)
InterlockedExchangeAdd((LONG *)&This->refs, NORMALEXTREFS);
else
@ -614,6 +618,7 @@ static HRESULT ifproxy_release_public_refs(struct ifproxy * This)
rif.cPublicRefs = public_refs;
rif.cPrivateRefs = 0;
hr = IRemUnknown_RemRelease(remunk, 1, &rif);
IRemUnknown_Release(remunk);
if (hr == S_OK)
InterlockedExchangeAdd((LONG *)&This->refs, -public_refs);
else if (hr == RPC_E_DISCONNECTED)
@ -967,8 +972,11 @@ static HRESULT proxy_manager_get_remunknown(struct proxy_manager * This, IRemUnk
EnterCriticalSection(&This->cs);
if (This->remunk)
{
/* already created - return existing object */
*remunk = This->remunk;
IRemUnknown_AddRef(*remunk);
}
else if (!This->parent)
/* disconnected - we can't create IRemUnknown */
hr = S_FALSE;
@ -988,9 +996,12 @@ static HRESULT proxy_manager_get_remunknown(struct proxy_manager * This, IRemUnk
/* do the unmarshal */
hr = unmarshal_object(&stdobjref, This->parent, This->dest_context,
This->dest_context_data, &IID_IRemUnknown,
&This->oxid_info, (void**)&This->remunk);
&This->oxid_info, (void**)remunk);
if (hr == S_OK)
*remunk = This->remunk;
{
This->remunk = *remunk;
IRemUnknown_AddRef(This->remunk);
}
}
LeaveCriticalSection(&This->cs);