ole32: Hold a reference to the stub manager throughout an incoming call.

This will enable us to defer deleting the manager until the call has finished.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2015-10-13 14:49:14 +01:00 committed by Alexandre Julliard
parent c2dc6f3ef2
commit 35571a7254
3 changed files with 11 additions and 4 deletions

View File

@ -195,7 +195,8 @@ struct stub_manager *get_stub_manager_from_object(APARTMENT *apt, IUnknown *obje
BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid) DECLSPEC_HIDDEN;
BOOL stub_manager_is_table_marshaled(struct stub_manager *m, const IPID *ipid) DECLSPEC_HIDDEN;
void stub_manager_release_marshal_data(struct stub_manager *m, ULONG refs, const IPID *ipid, BOOL tableweak) DECLSPEC_HIDDEN;
HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt, IRpcStubBuffer **stub, IRpcChannelBuffer **chan, IID *iid, IUnknown **iface) DECLSPEC_HIDDEN;
HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt, struct stub_manager **manager, IRpcStubBuffer **stub,
IRpcChannelBuffer **chan, IID *iid, IUnknown **iface) DECLSPEC_HIDDEN;
HRESULT start_apartment_remote_unknown(void) DECLSPEC_HIDDEN;
HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *obj, DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags) DECLSPEC_HIDDEN;

View File

@ -682,7 +682,7 @@ static HRESULT WINAPI ClientRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
}
RpcBindingInqObject(message_state->binding_handle, &ipid);
hr = ipid_get_dispatch_params(&ipid, &apt, &message_state->params.stub,
hr = ipid_get_dispatch_params(&ipid, &apt, NULL, &message_state->params.stub,
&message_state->params.chan,
&message_state->params.iid,
&message_state->params.iface);
@ -1441,6 +1441,7 @@ exit:
static void __RPC_STUB dispatch_rpc(RPC_MESSAGE *msg)
{
struct dispatch_params *params;
struct stub_manager *stub_manager;
APARTMENT *apt;
IPID ipid;
HRESULT hr;
@ -1456,7 +1457,7 @@ static void __RPC_STUB dispatch_rpc(RPC_MESSAGE *msg)
return;
}
hr = ipid_get_dispatch_params(&ipid, &apt, &params->stub, &params->chan,
hr = ipid_get_dispatch_params(&ipid, &apt, &stub_manager, &params->stub, &params->chan,
&params->iid, &params->iface);
if (hr != S_OK)
{
@ -1514,6 +1515,7 @@ static void __RPC_STUB dispatch_rpc(RPC_MESSAGE *msg)
IRpcStubBuffer_Release(params->stub);
HeapFree(GetProcessHeap(), 0, params);
stub_manager_int_release(stub_manager);
apartment_release(apt);
/* if IRpcStubBuffer_Invoke fails, we should raise an exception to tell

View File

@ -506,6 +506,7 @@ static HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, stru
* release the references to all objects (except iface) if the function
* returned success, otherwise no references are returned. */
HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt,
struct stub_manager **manager,
IRpcStubBuffer **stub, IRpcChannelBuffer **chan,
IID *iid, IUnknown **iface)
{
@ -528,7 +529,10 @@ HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt,
*iid = ifstub->iid;
*iface = ifstub->iface;
stub_manager_int_release(stubmgr);
if (manager)
*manager = stubmgr;
else
stub_manager_int_release(stubmgr);
return S_OK;
}
else