Jacek Caban : urlmon: Release protocol sink in Terminate.

Alexandre Julliard julliard at winehq.org
Mon Dec 31 12:32:17 CST 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Dec 28 14:54:22 2007 +0100

urlmon: Release protocol sink in Terminate.

---

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

diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c
index f9cf389..e3a432f 100644
--- a/dlls/urlmon/bindprot.c
+++ b/dlls/urlmon/bindprot.c
@@ -36,6 +36,8 @@ typedef struct {
     IServiceProvider *service_provider;
 
     LONG priority;
+
+    BOOL reported_result;
 } BindProtocol;
 
 #define PROTOCOL(x)  ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
@@ -205,7 +207,18 @@ static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocol *iface, DWORD dwO
 
     TRACE("(%p)->(%08x)\n", This, dwOptions);
 
+    if(!This->reported_result)
+        return E_FAIL;
+
     IInternetProtocol_Terminate(This->protocol, 0);
+
+    set_binding_sink(PROTOCOL(This), NULL);
+
+    if(This->bind_info) {
+        IInternetBindInfo_Release(This->bind_info);
+        This->bind_info = NULL;
+    }
+
     return S_OK;
 }
 
@@ -440,6 +453,14 @@ static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface
 
     TRACE("(%p)->(%p)\n", This, pProtocolData);
 
+    TRACE("flags %x state %x data %p cb %u\n", pProtocolData->grfFlags, pProtocolData->dwState,
+          pProtocolData->pData, pProtocolData->cbData);
+
+    if(!This->protocol_sink) {
+        IInternetProtocol_Continue(This->protocol, pProtocolData);
+        return S_OK;
+    }
+
     return IInternetProtocolSink_Switch(This->protocol_sink, pProtocolData);
 }
 
@@ -482,6 +503,9 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *i
 
     TRACE("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax);
 
+    if(!This->protocol_sink)
+        return S_OK;
+
     return IInternetProtocolSink_ReportData(This->protocol_sink, grfBSCF, ulProgress, ulProgressMax);
 }
 
@@ -492,6 +516,11 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink
 
     TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
 
+    if(!This->protocol_sink)
+        return E_FAIL;
+
+    This->reported_result = TRUE;
+
     return IInternetProtocolSink_ReportResult(This->protocol_sink, hrResult, dwError, szResult);
 }
 




More information about the wine-cvs mailing list