Nikolay Sivov : ole32: Simplify apartment lookup helper.

Alexandre Julliard julliard at winehq.org
Wed Aug 26 15:24:44 CDT 2020


Module: wine
Branch: master
Commit: 89d8e13bf0d922bce2ed3fc9bab7d89c945d4408
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=89d8e13bf0d922bce2ed3fc9bab7d89c945d4408

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Aug 25 18:18:14 2020 +0300

ole32: Simplify apartment lookup helper.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 4bd8c2474b..a68cab0fe9 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 7958b119bc..6e8b7ae2cf 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 9fb68e66f0..8cc35354d5 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 16f9c3dc52..338b89750e 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)




More information about the wine-cvs mailing list