On 01.08.2017 23:27, Zebediah Figura wrote:
@@ -1173,13 +1175,16 @@ DWORD apartment_release(struct apartment *apt) stub_manager_int_release(stubmgr); }
LIST_FOR_EACH_SAFE(cursor, cursor2, &apt->psclsids)
LIST_FOR_EACH_SAFE(cursor, cursor2, &RegisteredPSCLSIDList)
Accessing a global list from multiple threads requires synchronization (for example, using a CS to avoid conflicting access). Using apt->cs is not sufficient because it might be a different one for each thread. The same also applies to all other places where the list is used.
@@ -1177,6 +1196,15 @@ static void test_CoRegisterPSClsid(void) hr = CoRegisterPSClsid(&IID_IWineTest, &CLSID_WineTestPSFactoryBuffer); ok_ole_success(hr, "CoRegisterPSClsid");
- hr = CoGetPSClsid(&IID_IWineTest, &clsid);
- ok_ole_success(hr, "CoGetPSClsid");
- ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
wine_dbgstr_guid(&CLSID_WineTestPSFactoryBuffer), wine_dbgstr_guid(&clsid));
- thread = CreateThread(NULL, 0, register_ps_clsid_thread, NULL, 0, &tid);
- ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
- ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
The thread handle is leaked here. Also, it would be more convincing to run the tests for both STA and MTA.