Robert Shearman : oleaut32:
Delay the creation of the stub object for IDispatch until it is
actually used .
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Sep 7 03:45:41 CDT 2006
Module: wine
Branch: master
Commit: 4d0b1e3d074e3507465d226ce0948f12dfd2e6c6
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=4d0b1e3d074e3507465d226ce0948f12dfd2e6c6
Author: Robert Shearman <rob at codeweavers.com>
Date: Tue Aug 29 21:12:16 2006 +0100
oleaut32: Delay the creation of the stub object for IDispatch until it is actually used.
---
dlls/oleaut32/tmarshal.c | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c
index 396cca3..a9d0b32 100644
--- a/dlls/oleaut32/tmarshal.c
+++ b/dlls/oleaut32/tmarshal.c
@@ -1630,6 +1630,7 @@ typedef struct _TMStubImpl {
ITypeInfo *tinfo;
IID iid;
IRpcStubBuffer *dispatch_stub;
+ BOOL dispatch_derivative;
} TMStubImpl;
static HRESULT WINAPI
@@ -1667,6 +1668,8 @@ TMStubImpl_Release(LPRPCSTUBBUFFER iface
{
IRpcStubBuffer_Disconnect(iface);
ITypeInfo_Release(This->tinfo);
+ if (This->dispatch_stub)
+ IRpcStubBuffer_Release(This->dispatch_stub);
CoTaskMemFree(This);
}
return refCount;
@@ -1727,8 +1730,20 @@ TMStubImpl_Invoke(
return E_UNEXPECTED;
}
- if (This->dispatch_stub && xmsg->iMethod < sizeof(IDispatchVtbl)/sizeof(void *))
+ if (This->dispatch_derivative && xmsg->iMethod < sizeof(IDispatchVtbl)/sizeof(void *))
+ {
+ IPSFactoryBuffer *factory_buffer;
+ hres = get_facbuf_for_iid(&IID_IDispatch, &factory_buffer);
+ if (hres == S_OK)
+ {
+ hres = IPSFactoryBuffer_CreateStub(factory_buffer, &IID_IDispatch,
+ This->pUnk, &This->dispatch_stub);
+ IPSFactoryBuffer_Release(factory_buffer);
+ }
+ if (hres != S_OK)
+ return hres;
return IRpcStubBuffer_Invoke(This->dispatch_stub, xmsg, rpcchanbuf);
+ }
memset(&buf,0,sizeof(buf));
buf.size = xmsg->cbBuffer;
@@ -1915,6 +1930,7 @@ PSFacBuf_CreateStub(
stub->ref = 1;
stub->tinfo = tinfo;
stub->dispatch_stub = NULL;
+ stub->dispatch_derivative = FALSE;
memcpy(&(stub->iid),riid,sizeof(*riid));
hres = IRpcStubBuffer_Connect((LPRPCSTUBBUFFER)stub,pUnkServer);
*ppStub = (LPRPCSTUBBUFFER)stub;
@@ -1927,16 +1943,7 @@ PSFacBuf_CreateStub(
if (hres == S_OK)
{
if (typeattr->wTypeFlags & TYPEFLAG_FDISPATCHABLE)
- {
- IPSFactoryBuffer *factory_buffer;
- hres = get_facbuf_for_iid(&IID_IDispatch, &factory_buffer);
- if (hres == S_OK)
- {
- hres = IPSFactoryBuffer_CreateStub(factory_buffer, &IID_IDispatch,
- pUnkServer, &stub->dispatch_stub);
- IPSFactoryBuffer_Release(factory_buffer);
- }
- }
+ stub->dispatch_derivative = TRUE;
ITypeInfo_ReleaseTypeAttr(tinfo, typeattr);
}
More information about the wine-cvs
mailing list