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

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2020-06-24 23:30:06 +03:00 committed by Alexandre Julliard
parent 1dc3383389
commit 1f6423f778
1 changed files with 4 additions and 0 deletions

View File

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