If I'm going to mess around with COM again, I may as well submit some pieces of the stuff that Mike Hearn still haven't got around to submit... Log: Ove Kaaven <ovek@xxxxxxxxxxxxxxx> Properly handle destroying the first connection in the connection cache. Index: dlls/rpcrt4/rpc_binding.c =================================================================== RCS file: /home/wine/wine/dlls/rpcrt4/rpc_binding.c,v retrieving revision 1.16 diff -u -r1.16 rpc_binding.c --- dlls/rpcrt4/rpc_binding.c 20 Nov 2003 23:42:38 -0000 1.16 +++ dlls/rpcrt4/rpc_binding.c 8 Jan 2004 14:28:21 -0000 @@ -136,9 +136,13 @@ EnterCriticalSection(&conn_cache_cs); PrevConnection = conn_cache; - while (PrevConnection && PrevConnection->Next != Connection) - PrevConnection = PrevConnection->Next; - if (PrevConnection) PrevConnection->Next = Connection->Next; + if (PrevConnection == Connection) { + conn_cache = Connection->Next; + } else { + while (PrevConnection && PrevConnection->Next != Connection) + PrevConnection = PrevConnection->Next; + if (PrevConnection) PrevConnection->Next = Connection->Next; + } LeaveCriticalSection(&conn_cache_cs); RPCRT4_CloseConnection(Connection);