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

Alexandre Julliard julliard at winehq.org
Wed Jun 24 15:47:35 CDT 2020


Module: wine
Branch: master
Commit: 1f6423f778f7036a3875613e10b9c8c3b84584f0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1f6423f778f7036a3875613e10b9c8c3b84584f0

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Wed Jun 24 23:30:06 2020 +0300

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

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/loader.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index bc437d1a58..2a0f1d51a3 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -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))




More information about the wine-cvs mailing list