Skip to content

Commit

Permalink
fix: Only free windows TLS if t_data exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Berstanio committed Dec 29, 2024
1 parent b35aac9 commit 0ff1276
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gdx-jnigen-runtime/src/main/native/jni_env_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD fdwReason, LPVOID lpvReserved) {
// Docs say no cleanup when lpvReserved != NULL
if (fdwReason == DLL_THREAD_DETACH && lpvReserved == NULL) {
ThreadData* t_data = (ThreadData*)TlsGetValue(envTls);
detach_jni_env(t_data);
if (t_data != NULL)
detach_jni_env(t_data);
}

return TRUE;
Expand Down

0 comments on commit 0ff1276

Please sign in to comment.