Huw Davies : ole32: Hold a reference to the stub manager throughout an incoming call.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Oct 14 11:12:49 CDT 2015
Module: wine
Branch: master
Commit: 35571a725455a1592ba5b761c00fd3733931b148
URL: http://source.winehq.org/git/wine.git/?a=commit;h=35571a725455a1592ba5b761c00fd3733931b148
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Oct 13 14:49:14 2015 +0100
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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ole32/compobj_private.h | 3 ++-
dlls/ole32/rpc.c | 6 ++++--
dlls/ole32/stubmanager.c | 6 +++++-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 857943a..b2cf92e 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -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;
diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 2455464..0797784 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -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, ¶ms->stub, ¶ms->chan,
+ hr = ipid_get_dispatch_params(&ipid, &apt, &stub_manager, ¶ms->stub, ¶ms->chan,
¶ms->iid, ¶ms->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
diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c
index 30e2054..fa9a704 100644
--- a/dlls/ole32/stubmanager.c
+++ b/dlls/ole32/stubmanager.c
@@ -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
More information about the wine-cvs
mailing list