From 97be0be7e4e19152e5c810aa9606484be85ba181 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Tue, 19 Jul 2005 19:13:11 +0000 Subject: [PATCH] - We should be starting with 1 reference. - IRpcStubBuffer_Disconnect can be called more than once. --- dlls/ole32/oleproxy.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/ole32/oleproxy.c b/dlls/ole32/oleproxy.c index a5c7898eb0b..ba15a75f9ab 100644 --- a/dlls/ole32/oleproxy.c +++ b/dlls/ole32/oleproxy.c @@ -116,7 +116,10 @@ CFStub_Release(LPRPCSTUBBUFFER iface) { ULONG ref; ref = InterlockedDecrement(&This->ref); - if (!ref) HeapFree(GetProcessHeap(),0,This); + if (!ref) { + IRpcStubBuffer_Disconnect(iface); + HeapFree(GetProcessHeap(),0,This); + } return ref; } @@ -133,9 +136,12 @@ static void WINAPI CFStub_Disconnect(LPRPCSTUBBUFFER iface) { CFStub *This = (CFStub *)iface; - IUnknown_Release(This->pUnkServer); - This->pUnkServer = NULL; + if (This->pUnkServer) { + IUnknown_Release(This->pUnkServer); + This->pUnkServer = NULL; + } } + static HRESULT WINAPI CFStub_Invoke( LPRPCSTUBBUFFER iface,RPCOLEMESSAGE* msg,IRpcChannelBuffer* chanbuf @@ -654,7 +660,7 @@ static HRESULT RemUnkStub_Construct(IRpcStubBuffer **ppStub) RemUnkStub *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); if (!This) return E_OUTOFMEMORY; This->lpVtbl = &RemUnkStub_VTable; - This->refs = 0; + This->refs = 1; This->iface = NULL; *ppStub = (IRpcStubBuffer*)This; return S_OK;