IUnknown isn't a remotable interface so the stub manager shouldn't

need a marshaller for it.
This commit is contained in:
Robert Shearman 2005-06-09 09:45:59 +00:00 committed by Alexandre Julliard
parent 0c5118144a
commit 037bdc0dc0
2 changed files with 24 additions and 16 deletions

View File

@ -90,28 +90,36 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno
struct stub_manager *manager; struct stub_manager *manager;
struct ifstub *ifstub; struct ifstub *ifstub;
BOOL tablemarshal; BOOL tablemarshal;
IRpcStubBuffer *stub; IRpcStubBuffer *stub = NULL;
IPSFactoryBuffer *psfb;
HRESULT hr; HRESULT hr;
hr = apartment_getoxid(apt, &stdobjref->oxid); hr = apartment_getoxid(apt, &stdobjref->oxid);
if (hr != S_OK) if (hr != S_OK)
return hr; return hr;
hr = get_facbuf_for_iid(riid, &psfb); /* IUnknown doesn't require a stub buffer, because it never goes out on
if (hr != S_OK) * the wire */
if (!IsEqualIID(riid, &IID_IUnknown))
{ {
ERR("couldn't get IPSFactory buffer for interface %s\n", debugstr_guid(riid)); IPSFactoryBuffer *psfb;
return hr;
}
hr = IPSFactoryBuffer_CreateStub(psfb, riid, obj, &stub); hr = get_facbuf_for_iid(riid, &psfb);
IPSFactoryBuffer_Release(psfb); if (hr != S_OK)
if (hr != S_OK) {
{ ERR("couldn't get IPSFactory buffer for interface %s\n", debugstr_guid(riid));
ERR("Failed to create an IRpcStubBuffer from IPSFactory for %s\n", debugstr_guid(riid)); return hr;
return hr; }
hr = IPSFactoryBuffer_CreateStub(psfb, riid, obj, &stub);
IPSFactoryBuffer_Release(psfb);
if (hr != S_OK)
{
ERR("Failed to create an IRpcStubBuffer from IPSFactory for %s\n", debugstr_guid(riid));
return hr;
}
} }
else /* need to addref object anyway */
IUnknown_AddRef(obj);
if (mshlflags & MSHLFLAGS_NOPING) if (mshlflags & MSHLFLAGS_NOPING)
stdobjref->flags = SORF_NOPING; stdobjref->flags = SORF_NOPING;
@ -129,7 +137,7 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno
manager = new_stub_manager(apt, obj, mshlflags); manager = new_stub_manager(apt, obj, mshlflags);
if (!manager) if (!manager)
{ {
IRpcStubBuffer_Release(stub); if (stub) IRpcStubBuffer_Release(stub);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
} }

View File

@ -409,7 +409,7 @@ struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *s
if (!stub) return NULL; if (!stub) return NULL;
stub->stubbuffer = sb; stub->stubbuffer = sb;
IUnknown_AddRef(sb); if (sb) IRpcStubBuffer_AddRef(sb);
/* no need to ref this, same object as sb */ /* no need to ref this, same object as sb */
stub->iface = iptr; stub->iface = iptr;
@ -446,7 +446,7 @@ static void stub_manager_delete_ifstub(struct stub_manager *m, struct ifstub *if
RPC_UnregisterInterface(&ifstub->iid); RPC_UnregisterInterface(&ifstub->iid);
IUnknown_Release(ifstub->stubbuffer); if (ifstub->stubbuffer) IUnknown_Release(ifstub->stubbuffer);
IUnknown_Release(ifstub->iface); IUnknown_Release(ifstub->iface);
HeapFree(GetProcessHeap(), 0, ifstub); HeapFree(GetProcessHeap(), 0, ifstub);