Commit 88f7fd5d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use TLS_OUT_OF_INDEXES as invalid TLS value.

Spotted by Vitaliy Margolen.
parent 08d8a5ea
......@@ -44,7 +44,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
HINSTANCE hInst;
DWORD mshtml_tls = 0;
DWORD mshtml_tls = TLS_OUT_OF_INDEXES;
static HINSTANCE shdoclc = NULL;
......@@ -69,7 +69,7 @@ static void process_detach(void)
if(shdoclc)
FreeLibrary(shdoclc);
if(mshtml_tls)
if(mshtml_tls != TLS_OUT_OF_INDEXES)
TlsFree(mshtml_tls);
}
......
......@@ -478,11 +478,19 @@ thread_data_t *get_thread_data(BOOL create)
{
thread_data_t *thread_data;
if(!mshtml_tls) {
if(create)
mshtml_tls = TlsAlloc();
else
if(mshtml_tls == TLS_OUT_OF_INDEXES) {
DWORD tls;
if(!create)
return NULL;
tls = TlsAlloc();
if(tls == TLS_OUT_OF_INDEXES)
return NULL;
tls = InterlockedCompareExchange((LONG*)&mshtml_tls, tls, TLS_OUT_OF_INDEXES);
if(tls != mshtml_tls)
TlsFree(tls);
}
thread_data = TlsGetValue(mshtml_tls);
......
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