Module: wine Branch: master Commit: f799192b3e42ff9fe236eef883f2d6ad88f9c21f URL: http://source.winehq.org/git/wine.git/?a=commit;h=f799192b3e42ff9fe236eef883...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Feb 8 02:32:48 2007 +0100
urlmon: Fix ReportResult on async protocols.
---
dlls/urlmon/binding.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c index 8bc954d..9a1ef78 100644 --- a/dlls/urlmon/binding.c +++ b/dlls/urlmon/binding.c @@ -1,5 +1,5 @@ /* - * Copyright 2005 Jacek Caban + * Copyright 2005-2007 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -895,6 +895,18 @@ static HRESULT WINAPI InternetProtocolSi return S_OK; }
+static void report_result_proc(Binding *binding, task_header_t *t) +{ + IInternetProtocol_Terminate(binding->protocol, 0); + + if(binding->request_locked) { + IInternetProtocol_UnlockRequest(binding->protocol); + binding->request_locked = FALSE; + } + + HeapFree(GetProcessHeap(), 0, t); +} + static HRESULT WINAPI InternetProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult) { @@ -902,7 +914,13 @@ static HRESULT WINAPI InternetProtocolSi
TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
- IInternetProtocol_Terminate(This->protocol, 0); + if(GetCurrentThreadId() == This->apartment_thread && !This->continue_call) { + IInternetProtocol_Terminate(This->protocol, 0); + }else { + task_header_t *task = HeapAlloc(GetProcessHeap(), 0, sizeof(task_header_t)); + push_task(This, task, report_result_proc); + } + return S_OK; }