Give IUnknown its own ifstub to fix ref-counting and ipid storage
issues.
This commit is contained in:
parent
da8b3dd7f2
commit
5bef770490
|
@ -375,7 +375,7 @@ static HRESULT ifproxy_release_public_refs(struct ifproxy * This)
|
||||||
static void ifproxy_disconnect(struct ifproxy * This)
|
static void ifproxy_disconnect(struct ifproxy * This)
|
||||||
{
|
{
|
||||||
ifproxy_release_public_refs(This);
|
ifproxy_release_public_refs(This);
|
||||||
IRpcProxyBuffer_Disconnect(This->proxy);
|
if (This->proxy) IRpcProxyBuffer_Disconnect(This->proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ifproxy_destroy(struct ifproxy * This)
|
static void ifproxy_destroy(struct ifproxy * This)
|
||||||
|
@ -483,6 +483,15 @@ static HRESULT proxy_manager_create_ifproxy(
|
||||||
ifproxy->refs = cPublicRefs;
|
ifproxy->refs = cPublicRefs;
|
||||||
ifproxy->proxy = NULL;
|
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);
|
hr = get_facbuf_for_iid(riid, &psfb);
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
{
|
{
|
||||||
|
@ -503,6 +512,7 @@ static HRESULT proxy_manager_create_ifproxy(
|
||||||
|
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
hr = IRpcProxyBuffer_Connect(ifproxy->proxy, This->chan);
|
hr = IRpcProxyBuffer_Connect(ifproxy->proxy, This->chan);
|
||||||
|
}
|
||||||
|
|
||||||
/* get at least one external reference to the object to keep it alive */
|
/* get at least one external reference to the object to keep it alive */
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
|
@ -843,16 +853,6 @@ static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt, REFI
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hr == S_OK)
|
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;
|
struct ifproxy * ifproxy;
|
||||||
hr = proxy_manager_find_ifproxy(proxy_manager, riid, &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;
|
*object = ifproxy->iface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* release our reference to the proxy manager - the client/apartment
|
/* release our reference to the proxy manager - the client/apartment
|
||||||
* will hold on to the remaining reference for us */
|
* will hold on to the remaining reference for us */
|
||||||
|
|
|
@ -803,9 +803,7 @@ static void test_message_filter()
|
||||||
|
|
||||||
IClassFactory_Release(cf);
|
IClassFactory_Release(cf);
|
||||||
|
|
||||||
/* FIXME: this is a regression caused by the fact that I faked the
|
ok_no_locks();
|
||||||
* IUnknown unmarshaling too much and didn't give it its own ifstub. */
|
|
||||||
todo_wine { ok_no_locks(); }
|
|
||||||
|
|
||||||
end_host_object(tid, thread);
|
end_host_object(tid, thread);
|
||||||
}
|
}
|
||||||
|
@ -861,7 +859,7 @@ static void test_proxy_interfaces()
|
||||||
ok_more_than_one_lock();
|
ok_more_than_one_lock();
|
||||||
|
|
||||||
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
|
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);
|
ok_ole_success(hr, CoReleaseMarshalData);
|
||||||
IStream_Release(pStream);
|
IStream_Release(pStream);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue