Jacek Caban : urlmon: Avoid direct notifications from callbacks from Read call.

Alexandre Julliard julliard at winehq.org
Mon Sep 3 13:19:12 CDT 2012


Module: wine
Branch: master
Commit: 719ab21d751558811c66f050f9c5151c474452a9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=719ab21d751558811c66f050f9c5151c474452a9

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Sep  3 13:58:55 2012 +0200

urlmon: Avoid direct notifications from callbacks from Read call.

---

 dlls/urlmon/bindprot.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c
index 48c9130..60912a4 100644
--- a/dlls/urlmon/bindprot.c
+++ b/dlls/urlmon/bindprot.c
@@ -171,9 +171,14 @@ static void push_task(BindProtocol *This, task_header_t *task, task_proc_t proc)
     }
 }
 
+static inline BOOL is_apartment_thread(BindProtocol *This)
+{
+    return This->apartment_thread == GetCurrentThreadId();
+}
+
 static inline BOOL do_direct_notif(BindProtocol *This)
 {
-    return !(This->pi & PI_APARTMENTTHREADED) || (This->apartment_thread == GetCurrentThreadId() && !This->continue_call);
+    return !(This->pi & PI_APARTMENTTHREADED) || (is_apartment_thread(This) && !This->continue_call);
 }
 
 static HRESULT handle_mime_filter(BindProtocol *This, IInternetProtocol *mime_filter)
@@ -735,7 +740,11 @@ static HRESULT WINAPI ProtocolHandler_Read(IInternetProtocol *iface, void *pv,
     if(read < cb) {
         ULONG cread = 0;
 
+        if(is_apartment_thread(This))
+            This->continue_call++;
         hres = IInternetProtocol_Read(This->protocol, (BYTE*)pv+read, cb-read, &cread);
+        if(is_apartment_thread(This))
+            This->continue_call--;
         read += cread;
     }
 




More information about the wine-cvs mailing list