Jacek Caban : urlmon: Unlock protocol only if it was locked.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Feb 7 16:00:21 CST 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Feb  7 17:28:17 2007 +0100

urlmon: Unlock protocol only if it was locked.

---

 dlls/urlmon/binding.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c
index bba7af4..79731c6 100644
--- a/dlls/urlmon/binding.c
+++ b/dlls/urlmon/binding.c
@@ -91,6 +91,7 @@ struct Binding {
     LPWSTR url;
     BOOL verified_mime;
     DWORD continue_call;
+    BOOL request_locked;
 
     DWORD apartment_thread;
     HWND notif_hwnd;
@@ -871,8 +872,10 @@ static HRESULT WINAPI InternetProtocolSi
     if(grfBSCF & BSCF_LASTDATANOTIFICATION)
         on_progress(This, ulProgress, ulProgressMax, BINDSTATUS_ENDDOWNLOADDATA, This->url);
 
-    if(grfBSCF & BSCF_FIRSTDATANOTIFICATION)
-        IInternetProtocol_LockRequest(This->protocol, 0);
+    if(!This->request_locked) {
+        HRESULT hres = IInternetProtocol_LockRequest(This->protocol, 0);
+        This->request_locked = SUCCEEDED(hres);
+    }
 
     on_data_available(This, grfBSCF);
 
@@ -1155,6 +1158,7 @@ static HRESULT Binding_Create(LPCWSTR ur
     ret->notif_hwnd = get_notif_hwnd();
     ret->verified_mime = FALSE;
     ret->continue_call = 0;
+    ret->request_locked = FALSE;
     ret->task_queue_head = ret->task_queue_tail = NULL;
 
     memset(&ret->bindinfo, 0, sizeof(BINDINFO));
@@ -1240,7 +1244,8 @@ HRESULT start_binding(LPCWSTR url, IBind
     }
 
     if(binding->stream->init_buf) {
-        IInternetProtocol_UnlockRequest(binding->protocol);
+        if(binding->request_locked)
+            IInternetProtocol_UnlockRequest(binding->protocol);
 
         IStream_AddRef(STREAM(binding->stream));
         *ppv = binding->stream;




More information about the wine-cvs mailing list