[PATCH] mshtml: Always report available data before stop_binding.

Rémi Bernon rbernon at codeweavers.com
Wed Oct 27 08:36:55 CDT 2021


Even if custom protocol handlers call ReportResult in LockRequest.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46213
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/urlmon/binding.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c
index a74970033b3..708b81194c7 100644
--- a/dlls/urlmon/binding.c
+++ b/dlls/urlmon/binding.c
@@ -1177,6 +1177,14 @@ static HRESULT WINAPI InternetProtocolSink_ReportResult(IInternetProtocolSink *i
 
     TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
 
+    /* Make sure we don't call stop_binding before available data has been reported,
+       as some custom protocol handlers call ReportResult within LockRequest */
+    if (!(This->state & BINDING_LOCKED) && hrResult == S_OK)
+    {
+        This->download_state = END_DOWNLOAD;
+        return S_OK;
+    }
+
     stop_binding(This, hrResult, szResult);
 
     IInternetProtocolEx_Terminate(&This->protocol->IInternetProtocolEx_iface, 0);
-- 
2.33.0




More information about the wine-devel mailing list