From 765a5c77eb919bca04a20c000b8a1df65f8d81eb Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Thu, 10 Aug 2023 18:53:50 +0200 Subject: [PATCH] Make sure to init dtoa_ctx_key also on win32 (#2834) Fixes page fault for mingw build Related to #2831 --- src/jv_dtoa_tsd.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/jv_dtoa_tsd.c b/src/jv_dtoa_tsd.c index cfccd40c31..4bea31b565 100644 --- a/src/jv_dtoa_tsd.c +++ b/src/jv_dtoa_tsd.c @@ -6,9 +6,7 @@ #include "jv_dtoa.h" #include "jv_alloc.h" -#ifndef WIN32 static pthread_once_t dtoa_ctx_once = PTHREAD_ONCE_INIT; -#endif static pthread_key_t dtoa_ctx_key; static void tsd_dtoa_ctx_dtor(void *ctx) { @@ -35,15 +33,11 @@ void jv_tsd_dtoa_ctx_init() { fprintf(stderr, "error: cannot create thread specific key"); abort(); } -#ifndef WIN32 atexit(jv_tsd_dtoa_ctx_fini); -#endif } inline struct dtoa_context *tsd_dtoa_context_get() { -#ifndef WIN32 pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail -#endif struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key); if (!ctx) { ctx = malloc(sizeof(struct dtoa_context));