Give IUnknown its own ifstub to fix ref-counting and ipid storage

issues.
This commit is contained in:
Robert Shearman 2005-01-27 10:39:44 +00:00 committed by Alexandre Julliard
parent da8b3dd7f2
commit 5bef770490
2 changed files with 40 additions and 43 deletions

View File

@ -375,7 +375,7 @@ static HRESULT ifproxy_release_public_refs(struct ifproxy * This)
static void ifproxy_disconnect(struct ifproxy * This)
{
ifproxy_release_public_refs(This);
IRpcProxyBuffer_Disconnect(This->proxy);
if (This->proxy) IRpcProxyBuffer_Disconnect(This->proxy);
}
static void ifproxy_destroy(struct ifproxy * This)
@ -483,6 +483,15 @@ static HRESULT proxy_manager_create_ifproxy(
ifproxy->refs = cPublicRefs;
ifproxy->proxy = NULL;
/* the IUnknown interface is special because it does not have a
* proxy associated with the ifproxy as we handle IUnknown ourselves */
if (IsEqualIID(riid, &IID_IUnknown))
{
ifproxy->iface = (void *)&This->lpVtbl;
hr = S_OK;
}
else
{
hr = get_facbuf_for_iid(riid, &psfb);
if (hr == S_OK)
{
@ -503,6 +512,7 @@ static HRESULT proxy_manager_create_ifproxy(
if (hr == S_OK)
hr = IRpcProxyBuffer_Connect(ifproxy->proxy, This->chan);
}
/* get at least one external reference to the object to keep it alive */
if (hr == S_OK)
@ -843,16 +853,6 @@ static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt, REFI
}
if (hr == S_OK)
{
/* the IUnknown interface is special because it does not have an
* ifproxy associated with it. we simply return the controlling
* IUnknown of the proxy manager. */
if (IsEqualIID(riid, &IID_IUnknown))
{
ClientIdentity_AddRef((IMultiQI*)&proxy_manager->lpVtbl);
*object = (LPVOID)(&proxy_manager->lpVtbl);
}
else
{
struct ifproxy * ifproxy;
hr = proxy_manager_find_ifproxy(proxy_manager, riid, &ifproxy);
@ -868,7 +868,6 @@ static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt, REFI
*object = ifproxy->iface;
}
}
}
/* release our reference to the proxy manager - the client/apartment
* will hold on to the remaining reference for us */

View File

@ -803,9 +803,7 @@ static void test_message_filter()
IClassFactory_Release(cf);
/* FIXME: this is a regression caused by the fact that I faked the
* IUnknown unmarshaling too much and didn't give it its own ifstub. */
todo_wine { ok_no_locks(); }
ok_no_locks();
end_host_object(tid, thread);
}
@ -861,7 +859,7 @@ static void test_proxy_interfaces()
ok_more_than_one_lock();
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData);
IStream_Release(pStream);