[PATCH 2/5] ole32: Simplify apartment lookup helper.

Nikolay Sivov nsivov at codeweavers.com
Tue Aug 25 10:18:14 CDT 2020


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/ole32/compobj.c         | 10 +++-------
 dlls/ole32/compobj_private.h |  2 +-
 dlls/ole32/marshal.c         |  4 ++--
 dlls/ole32/stubmanager.c     |  2 +-
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 4bd8c2474b6..a68cab0fe98 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -1237,12 +1237,8 @@ DWORD apartment_release(struct apartment *apt)
     return ret;
 }
 
-/* The given OXID must be local to this process: 
- *
- * 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)
+/* The given OXID must be local to this process */
+struct apartment *apartment_findfromoxid(OXID oxid)
 {
     struct apartment *result = NULL;
     struct list *cursor;
@@ -1254,7 +1250,7 @@ struct apartment *apartment_findfromoxid(OXID oxid, BOOL ref)
         if (apt->oxid == oxid)
         {
             result = apt;
-            if (ref) apartment_addref(result);
+            apartment_addref(result);
             break;
         }
     }
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 7958b119bc2..6e8b7ae2cfc 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -246,7 +246,7 @@ void OLEDD_UnInitialize(void) DECLSPEC_HIDDEN;
 
 /* 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;
 DWORD apartment_release(struct apartment *apt) DECLSPEC_HIDDEN;
 HRESULT apartment_disconnectproxies(struct apartment *apt) DECLSPEC_HIDDEN;
diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c
index 9fb68e66f07..8cc35354d53 100644
--- a/dlls/ole32/marshal.c
+++ b/dlls/ole32/marshal.c
@@ -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
      * unmarshals, etc, but if you abuse these rules then your proxy could end
      * 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)))
         {
@@ -1555,7 +1555,7 @@ static HRESULT std_release_marshal_data(IStream *pStm)
         wine_dbgstr_longlong(obj.std.oid),
         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",
             wine_dbgstr_longlong(obj.std.oxid));
diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c
index 16f9c3dc52c..338b89750ef 100644
--- a/dlls/ole32/stubmanager.c
+++ b/dlls/ole32/stubmanager.c
@@ -503,7 +503,7 @@ static HRESULT ipid_to_ifstub(const IPID *ipid, struct apartment **stub_apt,
 {
     /* FIXME: hack for IRemUnknown */
     if (ipid->Data2 == 0xffff)
-        *stub_apt = apartment_findfromoxid(*(const OXID *)ipid->Data4, TRUE);
+        *stub_apt = apartment_findfromoxid(*(const OXID *)ipid->Data4);
     else
         *stub_apt = apartment_findfromtid(ipid->Data2);
     if (!*stub_apt)
-- 
2.28.0




More information about the wine-devel mailing list