[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-patches
Subject:    [ole32] Bugfix for implicit MTA apartment initialization
From:       Rosen Diankov <rosen.diankov () gmail ! com>
Date:       2013-06-30 23:51:26
Message-ID: CAGrESbnKhM4hMW5f5AitvXeBM-K9R_jmFBKC0Ek3gG82e0ikVw () mail ! gmail ! com
[Download RAW message or body]

There are cases where the "called from wrong apartment" gets called in
ole32/rpc.c:ClientRpcChannelBuffer_SendReceive and there is no COM apartment
set.

Actually the thread should be using the implicit multithreaded apartment
created from a previous thread's Co­InitializeEx call

http://blogs.msdn.com/b/oldnewthing/archive/2013/04/19/10412399.aspx

Therefore the fix is really simple, add this check right in the beginning of
ClientRpcChannelBuffer_SendReceive

first reported in this bug:

http://bugs.winehq.org/show_bug.cgi?id=33749

rosen diankov,

["mtafix.wine-1.6-rc4.patch" (application/octet-stream)]

diff -ru wine-1.6-rc3-old/dlls/ole32/rpc.c wine-1.6-rc3/dlls/ole32/rpc.c
--- wine-1.6-rc3-old/dlls/ole32/rpc.c	2013-06-22 03:24:01.000000000 +0900
+++ wine-1.6-rc3/dlls/ole32/rpc.c	2013-06-27 22:49:36.189708324 +0900
@@ -834,6 +834,14 @@
 
     TRACE("(%p) iMethod=%d\n", olemsg, olemsg->iMethod);
 
+    /* There are cases where this function gets called with no COM apartment set
+       Actually the thread should be using the implicit multithreaded apartment \
created from a previous thread's Co ­InitializeEx call +       see \
http://blogs.msdn.com/b/oldnewthing/archive/2013/04/19/10412399.aspx +    */
+    if( !COM_CurrentApt() ) {
+        apartment_joinmta();
+    }
+
     hr = ClientRpcChannelBuffer_IsCorrectApartment(This, COM_CurrentApt());
     if (hr != S_OK)
     {





[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic