Commit 89d8e13b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Simplify apartment lookup helper.

parent 92957515
...@@ -1237,12 +1237,8 @@ DWORD apartment_release(struct apartment *apt) ...@@ -1237,12 +1237,8 @@ DWORD apartment_release(struct apartment *apt)
return ret; return ret;
} }
/* The given OXID must be local to this process: /* The given OXID must be local to this process */
* struct apartment *apartment_findfromoxid(OXID oxid)
* The ref parameter is here mostly to ensure people remember that
* they get one, you should normally take a ref for thread safety.
*/
struct apartment *apartment_findfromoxid(OXID oxid, BOOL ref)
{ {
struct apartment *result = NULL; struct apartment *result = NULL;
struct list *cursor; struct list *cursor;
...@@ -1254,7 +1250,7 @@ struct apartment *apartment_findfromoxid(OXID oxid, BOOL ref) ...@@ -1254,7 +1250,7 @@ struct apartment *apartment_findfromoxid(OXID oxid, BOOL ref)
if (apt->oxid == oxid) if (apt->oxid == oxid)
{ {
result = apt; result = apt;
if (ref) apartment_addref(result); apartment_addref(result);
break; break;
} }
} }
......
...@@ -246,7 +246,7 @@ void OLEDD_UnInitialize(void) DECLSPEC_HIDDEN; ...@@ -246,7 +246,7 @@ void OLEDD_UnInitialize(void) DECLSPEC_HIDDEN;
/* Apartment Functions */ /* Apartment Functions */
struct apartment *apartment_findfromoxid(OXID oxid, BOOL ref) DECLSPEC_HIDDEN; struct apartment *apartment_findfromoxid(OXID oxid) DECLSPEC_HIDDEN;
struct apartment *apartment_findfromtid(DWORD tid) DECLSPEC_HIDDEN; struct apartment *apartment_findfromtid(DWORD tid) DECLSPEC_HIDDEN;
DWORD apartment_release(struct apartment *apt) DECLSPEC_HIDDEN; DWORD apartment_release(struct apartment *apt) DECLSPEC_HIDDEN;
HRESULT apartment_disconnectproxies(struct apartment *apt) DECLSPEC_HIDDEN; HRESULT apartment_disconnectproxies(struct apartment *apt) DECLSPEC_HIDDEN;
......
...@@ -1468,7 +1468,7 @@ static HRESULT std_unmarshal_interface(MSHCTX dest_context, void *dest_context_d ...@@ -1468,7 +1468,7 @@ static HRESULT std_unmarshal_interface(MSHCTX dest_context, void *dest_context_d
* ignore table marshaling and normal marshaling rules regarding number of * ignore table marshaling and normal marshaling rules regarding number of
* unmarshals, etc, but if you abuse these rules then your proxy could end * unmarshals, etc, but if you abuse these rules then your proxy could end
* up returning RPC_E_DISCONNECTED. */ * up returning RPC_E_DISCONNECTED. */
if ((stub_apt = apartment_findfromoxid(obj.std.oxid, TRUE))) if ((stub_apt = apartment_findfromoxid(obj.std.oxid)))
{ {
if ((stubmgr = get_stub_manager(stub_apt, obj.std.oid))) if ((stubmgr = get_stub_manager(stub_apt, obj.std.oid)))
{ {
...@@ -1555,7 +1555,7 @@ static HRESULT std_release_marshal_data(IStream *pStm) ...@@ -1555,7 +1555,7 @@ static HRESULT std_release_marshal_data(IStream *pStm)
wine_dbgstr_longlong(obj.std.oid), wine_dbgstr_longlong(obj.std.oid),
wine_dbgstr_guid(&obj.std.ipid)); wine_dbgstr_guid(&obj.std.ipid));
if (!(apt = apartment_findfromoxid(obj.std.oxid, TRUE))) if (!(apt = apartment_findfromoxid(obj.std.oxid)))
{ {
WARN("Could not map OXID %s to apartment object\n", WARN("Could not map OXID %s to apartment object\n",
wine_dbgstr_longlong(obj.std.oxid)); wine_dbgstr_longlong(obj.std.oxid));
......
...@@ -503,7 +503,7 @@ static HRESULT ipid_to_ifstub(const IPID *ipid, struct apartment **stub_apt, ...@@ -503,7 +503,7 @@ static HRESULT ipid_to_ifstub(const IPID *ipid, struct apartment **stub_apt,
{ {
/* FIXME: hack for IRemUnknown */ /* FIXME: hack for IRemUnknown */
if (ipid->Data2 == 0xffff) if (ipid->Data2 == 0xffff)
*stub_apt = apartment_findfromoxid(*(const OXID *)ipid->Data4, TRUE); *stub_apt = apartment_findfromoxid(*(const OXID *)ipid->Data4);
else else
*stub_apt = apartment_findfromtid(ipid->Data2); *stub_apt = apartment_findfromtid(ipid->Data2);
if (!*stub_apt) if (!*stub_apt)
......
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