Commit 2a467027 authored by Alexandre Julliard's avatar Alexandre Julliard

Authors: Mike Hearn <mh@codeweavers.com>, Robert Shearman <rob@codeweavers.com>

- Rework RPC dispatch layer to be simpler and not get confused by server/client duality. - Make threads shut down at the right time and not access freed memory after apartment destruction. - Rename stub_dispatch_thread to client_dispatch_thread. - Add some more tracing - Check return value of WaitNamedPipe. - Change named pipe timeouts to 0.5s, which should be enough for even the slowest machines.
parent 795e9de8
......@@ -277,6 +277,8 @@ APARTMENT* COM_CreateApartment(DWORD model)
MTA = apt;
}
apt->shutdown_event = CreateEventA(NULL, TRUE, FALSE, NULL);
TRACE("Created apartment on OXID %s\n", wine_dbgstr_longlong(apt->oxid));
list_add_head(&apts, &apt->entry);
......@@ -338,6 +340,8 @@ DWORD COM_ApartmentRelease(struct apartment *apt)
if (apt->filter) IUnknown_Release(apt->filter);
DeleteCriticalSection(&apt->cs);
SetEvent(apt->shutdown_event);
CloseHandle(apt->shutdown_event);
CloseHandle(apt->thread);
HeapFree(GetProcessHeap(), 0, apt);
}
......
......@@ -5,7 +5,7 @@
* Copyright 1999 Sylvain St-Germain
* Copyright 2002 Marcus Meissner
* Copyright 2003 Ove Kåven, TransGaming Technologies
* Copyright 2004 Mike Hearn, CodeWeavers Inc
* Copyright 2004 Mike Hearn, Rob Shearman, CodeWeavers Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -131,8 +131,10 @@ struct apartment
struct list stubmgrs; /* stub managers for exported objects (CS cs) */
BOOL remunk_exported; /* has the IRemUnknown interface for this apartment been created yet? (CS cs) */
OID oidc; /* object ID counter, starts at 1, zero is invalid OID (CS cs). FIXME: remove me */
DWORD listenertid; /* id of apartment_listener_thread. FIXME: remove me */
/* FIXME: These should all be removed long term as they leak information that should be encapsulated */
OID oidc; /* object ID counter, starts at 1, zero is invalid OID (CS cs) */
DWORD listenertid; /* id of apartment_listener_thread */
HANDLE shutdown_event; /* event used to tell the client_dispatch_thread to shut down */
};
/* this is what is stored in TEB->ReservedForOle */
......
......@@ -868,6 +868,8 @@ static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt, REFI
stdobjref->oxid, stdobjref->oid,
chanbuf, &proxy_manager);
}
else
TRACE("proxy manager already created, using\n");
if (hr == S_OK)
{
......@@ -961,7 +963,7 @@ StdMarshalImpl_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, v
wine_dbgstr_longlong(stdobjref.oxid));
if (hres == S_OK)
hres = unmarshal_object(&stdobjref, apt, riid, ppv);
hres = unmarshal_object(&stdobjref, apt, riid, ppv);
if (hres) WARN("Failed with error 0x%08lx\n", hres);
else TRACE("Successfully created proxy %p\n", *ppv);
......@@ -1382,6 +1384,9 @@ cleanup:
if (pMarshalStream && (objref.flags & OBJREF_CUSTOM))
IStream_Release(pMarshalStream);
IMarshal_Release(pMarshal);
TRACE("completed with hr 0x%08lx\n", hr);
return hr;
}
......@@ -1437,6 +1442,9 @@ HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
}
IMarshal_Release(pMarshal);
TRACE("completed with hr 0x%lx\n", hr);
return hr;
}
......
......@@ -94,6 +94,7 @@ static void stub_manager_delete(struct stub_manager *m)
list_remove(&m->entry);
/* release every ifstub */
while ((cursor = list_head(&m->ifstubs)))
{
struct ifstub *ifstub = LIST_ENTRY(cursor, struct ifstub, entry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment