Article ID: 266713 - Last Review: September 26, 2005 - Revision: 3.1 BUG: IDispatch:GetIDsOfNames function may return E_FAIL even when the call succeedsThis article was previously published under Q266713 SYMPTOMS
The way that ATL implements the IDispatch::GetIDsOfNames function may result in E_FAIL being returned, even when the call succeeds.
CAUSE
When multiple threads call into an object's IDispatch::GetIDsOfNames function, the CComTypeInfoHolder::GetTI function is eventually called to load the type library and get the ITypeInfo interface. Because loading the type library and retrieving the interface are protected by a critical section, the second thread waits for the first thread to finish. Once the first thread releases the critical section, the second thread enters the critical section, finds m_pInfo is non-NULL (set by the first thread), and returns the hRes, which is set to E_FAIL. The IDispatch::GetIDsNames function eventually returns this E_FAIL.
RESOLUTION
To work around this problem, the CComTypeInfoHolder::GetTI function in the Atlcom.h file must be modified as follows (all changes are marked with the comments "ADD" and "END ADD"):
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section. | Article Translations
|
Back to the top
