File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -384,6 +384,8 @@ mi_decl_noinline static void mi_tld_free(mi_tld_t* tld) {
384384 if (tld == NULL || tld == MI_TLD_INVALID ) return ;
385385 mi_atomic_decrement_relaxed (& tld -> subproc -> thread_count );
386386 tld -> thread_id = MI_THREADID_INVALID ; // note: not 0 as that would re-initialize tld_main
387+ // we also need to set an invalid tid for tld_main as sometimes the same thread-id
388+ // is reused by the OS after a thread has terminated. (see issue #1287)
387389 mi_lock_done (& tld -> theaps_lock );
388390 _mi_meta_free (tld , sizeof (mi_tld_t ), tld -> memid ); // note: safe for static tld_main
389391}
Original file line number Diff line number Diff line change @@ -24,7 +24,11 @@ static Static s = Static();
2424
2525void Test (void ) {
2626 char * s = mi_mallocn_tp (char , 128 );
27+ #ifdef _WIN32
28+ strcpy_s (s, 128 , " hello world!" );
29+ #else
2730 strlcpy (s, " hello world!" , 128 );
31+ #endif
2832 printf (" message from static dll: %s\n " , s);
2933 mi_free (s);
3034}
You can’t perform that action at this time.
0 commit comments