Rob Shearman : urlmon: Fix race in protocol tests.
Alexandre Julliard
julliard at winehq.org
Tue Sep 30 11:15:46 CDT 2008
Module: wine
Branch: master
Commit: 601b3b2732eb9da816c7805c594376ad8f7d0bdd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=601b3b2732eb9da816c7805c594376ad8f7d0bdd
Author: Rob Shearman <robertshearman at gmail.com>
Date: Sun Sep 28 16:38:05 2008 +0100
urlmon: Fix race in protocol tests.
The value of *called is set asynchronously and so the callback
function could be called after IInternetProtocol_Read returns
E_PENDING. The value of *called is only predictable after the
WaitForSingleObject call returns. Therefore, remove the checks on
*called before this call.
---
dlls/urlmon/tests/protocol.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index b986dfc..159af5d 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -1557,7 +1557,6 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
if(SUCCEEDED(hres)) {
BYTE buf[3600];
DWORD cb;
- int *called = (bindf & BINDF_FROMURLMON) ? &called_Switch : &called_ReportData;
test_priority(http_protocol);
@@ -1579,8 +1578,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
expect_hrResult = S_OK;
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
- ok((!*called && hres == E_PENDING && cb==0) ||
- (*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
+ ok((hres == E_PENDING && cb==0) ||
+ (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
if(bindf & BINDF_FROMURLMON)
@@ -1596,8 +1595,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
hres = IInternetProtocol_Read(http_protocol, buf, sizeof(buf), &cb);
if(hres == E_PENDING) {
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
- ok((!*called && hres == E_PENDING && cb==0) ||
- (*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
+ ok((hres == E_PENDING && cb==0) ||
+ (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
if(bindf & BINDF_FROMURLMON)
CHECK_CALLED(Switch);
More information about the wine-cvs
mailing list