On Mon, 2005-01-10 at 21:20, Bill Medland wrote:
Bill Medland (billmedland@mercuryspeed.com) Correct testing for multithreaded (as spotted by Paul Vriens; fix suggested by Robert Shearman)
Hi Bill,
it wasn't the check that was way over my head. The thing is, that with this code change we walk a new path in COM_CreateApartment.
I don't know what the result is but in CoInitializeEx we do:
545 if (!(apt = COM_CurrentInfo()->apt)) 546 { 547 apt = COM_CreateApartment(dwCoInit); 548 if (!apt) return E_OUTOFMEMORY; 549 }
and apparently that leaves us with a E_OUTOFMEMORY all the time. Which means that we will not come to the part:
559 COM_CurrentInfo()->inits++;
and that leads to errors as:
trace:ole:CoInitializeEx ((nil), 4) trace:ole:COM_CreateApartment thread 0xd is entering the multithreaded apartment trace:ole:CoInitializeEx ((nil), 2) err:ole:CoInitializeEx Attempt to change threading model of this apartment from 0x0 to 0x2
which also shows that the check is wrong. When CoInitializeEx is called with COINIT_DISABLE_OLE1DDE it shouldn't go in.
What MSDN also says is:
Any combination of values from the COINIT enumeration can be used, except that the COINIT_APARTMENTTHREADED and COINIT_MULTITHREADED flags cannot both be set.
So should that be accounted for as well?
Cheers,
Paul.