Commit 1f6423f7 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Call TLS callbacks for main exe on thread detach.

parent 1dc33833
...@@ -3178,6 +3178,7 @@ void WINAPI LdrShutdownThread(void) ...@@ -3178,6 +3178,7 @@ void WINAPI LdrShutdownThread(void)
{ {
PLIST_ENTRY mark, entry; PLIST_ENTRY mark, entry;
LDR_DATA_TABLE_ENTRY *mod; LDR_DATA_TABLE_ENTRY *mod;
WINE_MODREF *wm;
UINT i; UINT i;
void **pointers; void **pointers;
...@@ -3187,6 +3188,7 @@ void WINAPI LdrShutdownThread(void) ...@@ -3187,6 +3188,7 @@ void WINAPI LdrShutdownThread(void)
if (process_detaching) return; if (process_detaching) return;
RtlEnterCriticalSection( &loader_section ); RtlEnterCriticalSection( &loader_section );
wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
mark = &NtCurrentTeb()->Peb->LdrData->InInitializationOrderModuleList; mark = &NtCurrentTeb()->Peb->LdrData->InInitializationOrderModuleList;
for (entry = mark->Blink; entry != mark; entry = entry->Blink) for (entry = mark->Blink; entry != mark; entry = entry->Blink)
...@@ -3202,6 +3204,8 @@ void WINAPI LdrShutdownThread(void) ...@@ -3202,6 +3204,8 @@ void WINAPI LdrShutdownThread(void)
DLL_THREAD_DETACH, NULL ); DLL_THREAD_DETACH, NULL );
} }
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, DLL_THREAD_DETACH );
RtlAcquirePebLock(); RtlAcquirePebLock();
RemoveEntryList( &NtCurrentTeb()->TlsLinks ); RemoveEntryList( &NtCurrentTeb()->TlsLinks );
if ((pointers = NtCurrentTeb()->ThreadLocalStoragePointer)) if ((pointers = NtCurrentTeb()->ThreadLocalStoragePointer))
......
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