Updated COM_CreateApartment fix

Bill Medland billmedland at mercuryspeed.com
Tue Jan 11 08:51:50 CST 2005


Bill Medland (billmedland at mercuryspeed.com)
Corrected testing for multithreaded
(based upon observations by Paul Vriens, Christian Costa and Robert Shearman)
Added TRACE for investigating OXID errors

Index: wine/dlls/ole32/compobj.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj.c,v
retrieving revision 1.121
diff -u -r1.121 compobj.c
--- wine/dlls/ole32/compobj.c	6 Jan 2005 19:39:07 -0000	1.121
+++ wine/dlls/ole32/compobj.c	11 Jan 2005 14:44:25 -0000
@@ -22,6 +22,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
+ * Note
+ * 1. COINIT_MULTITHREADED is 0; it is the lack of COINIT_APARTMENTTHREADED
+ *    Therefore do not test against COINIT_MULTITHREADED
+ *
  * TODO list:           (items bunched together depend on each other)
  *
  *   - Switch wine_marshal_id to use IPIDs not IIDs
@@ -252,11 +256,11 @@
 
     if (!apt)
     {
-        if (model & COINIT_MULTITHREADED)
+        if (!(model & COINIT_APARTMENTTHREADED)) /* See note 1 above */
         {
             TRACE("thread 0x%lx is entering the multithreaded apartment\n", GetCurrentThreadId());
             COM_CurrentInfo()->apt = &MTA;
-            return apt;
+            return COM_CurrentInfo()->apt;
         }
 
         TRACE("creating new apartment, model=%ld\n", model);
@@ -281,6 +285,7 @@
         {
             /* FIXME: how does windoze create OXIDs? */
             apt->oxid = MTA.oxid | GetCurrentThreadId();
+            TRACE("Created apartment on OXID %s\n", wine_dbgstr_longlong(apt->oxid));
             apt->win = CreateWindowA(aptWinClass, NULL, 0,
                                      0, 0, 0, 0,
                                      0, 0, OLE32_hInstance, NULL);
@@ -316,7 +321,7 @@
 
         MARSHAL_Disconnect_Proxies(apt);
 
-        if ((apt->model & COINIT_APARTMENTTHREADED) && apt->win) DestroyWindow(apt->win);
+        if (apt->win) DestroyWindow(apt->win);
 
         if (!list_empty(&apt->stubmgrs))
         {




More information about the wine-patches mailing list