Commit b4da1403 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

combase: When looking up an apartment which has a given creator thread ID use…

combase: When looking up an apartment which has a given creator thread ID use multi-threaded apartment only if the thread doesn't have an apartment-threaded one. CoIncrementMTAUsage() always creates the MTA if it doesn't already exist, and mta->tid may accidently match the apt->tid of the apartment-threaded apartment of the thread. Signed-off-by: 's avatarDmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 251ab17a
......@@ -663,13 +663,20 @@ struct apartment * apartment_findfromtid(DWORD tid)
EnterCriticalSection(&apt_cs);
LIST_FOR_EACH_ENTRY(apt, &apts, struct apartment, entry)
{
if (apt->tid == tid)
if (apt != mta && apt->tid == tid)
{
result = apt;
apartment_addref(result);
break;
}
}
if (!result && mta && mta->tid == tid)
{
result = mta;
apartment_addref(result);
}
LeaveCriticalSection(&apt_cs);
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment