mshtml: Only allow one thread to use Gecko.

The new test doesn't pass, but it doesn't crash either, and that's
enough to fix the WinZip installer.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54071
This commit is contained in:
Alex Henrie 2023-05-16 22:54:33 -06:00 committed by Alexandre Julliard
parent 5d516dd931
commit 624b008f2e
2 changed files with 26 additions and 1 deletions

View file

@ -818,7 +818,8 @@ BOOL load_gecko(void)
MESSAGE("Could not find Wine Gecko. HTML rendering will be disabled.\n");
}
}else {
ret = pCompMgr != NULL;
FIXME("Gecko can only be used from one thread.\n");
ret = FALSE;
}
LeaveCriticalSection(&cs_load_gecko);

View file

@ -11980,6 +11980,29 @@ static void test_document_mode_lock(void)
IHTMLDocument2_Release(doc);
}
static DWORD WINAPI create_document_proc(void *param)
{
IHTMLDocument2 *doc = NULL;
HRESULT hres;
CoInitialize(NULL);
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IHTMLDocument2, (void**)&doc);
todo_wine
ok(hres == S_OK, "Creation of an HTMLDocument in a separate thread failed: %08lx\n", hres);
if (doc) IHTMLDocument2_Release(doc);
return 0;
}
static void test_threads(void)
{
HANDLE thread = CreateThread(NULL, 0, create_document_proc, 0, 0, NULL);
DWORD ret = WaitForSingleObject(thread, 2000);
ok(!ret, "Document creation thread failed to complete\n");
}
static void test_custom_user_agent(IHTMLDocument2 *doc)
{
static const WCHAR ua[] = L"1234567890xxxABC";
@ -12080,6 +12103,7 @@ START_TEST(dom)
test_quirks_mode();
test_document_mode_lock();
test_threads();
/* Run this last since it messes with the process-wide user agent */
if (winetest_interactive || ! is_ie_hardened()) {