Commit 37e38627 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Make get_typeinfo thread safe.

parent c1dc0e41
......@@ -63,19 +63,29 @@ HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
HRESULT hres;
if(!typelib) {
hres = LoadRegTypeLib(&LIBID_MSHTML, 4, 0, LOCALE_SYSTEM_DEFAULT, &typelib);
ITypeLib *tl;
hres = LoadRegTypeLib(&LIBID_MSHTML, 4, 0, LOCALE_SYSTEM_DEFAULT, &tl);
if(FAILED(hres)) {
ERR("LoadRegTypeLib failed: %08x\n", hres);
return hres;
}
if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
ITypeLib_Release(tl);
}
if(!typeinfos[tid]) {
hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], typeinfos+tid);
ITypeInfo *typeinfo;
hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &typeinfo);
if(FAILED(hres)) {
ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
return hres;
}
if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), typeinfo, NULL))
ITypeInfo_Release(typeinfo);
}
*typeinfo = typeinfos[tid];
......
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