Permalink
Browse files

SDL: Fix pthread_key_create failing

  • Loading branch information...
Gillou68310
Gillou68310 committed May 3, 2015
1 parent 6f605aa commit 155852040e079b6d924a829a88b1a3129dc41572
Showing with 11 additions and 0 deletions.
  1. +5 −0 jni/SDL2/src/core/android/SDL_android.c
  2. +6 −0 jni/ae-bridge/ae_exports.cpp
@@ -107,6 +107,11 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
return JNI_VERSION_1_4;
}
void JNI_OnUnload(JavaVM *vm, void *reserved)
{
pthread_key_delete(mThreadKey);
}
// Called before SDL_main() to initialize JNI bindings
void SDL_Android_Init(JNIEnv* mEnv, jclass cls)
{
@@ -48,6 +48,7 @@ static void *handleFront; // libmupen64plus-ui-console.so
// Function types
typedef jint (*pJNI_OnLoad) (JavaVM* vm, void* reserved);
typedef void (*pJNI_OnUnload) (JavaVM *vm, void *reserved);
typedef int (*pAeiInit) (JNIEnv* env, jclass cls);
typedef int (*pSdlInit) (JNIEnv* env, jclass cls);
typedef void (*pSdlSetScreen) (int width, int height, Uint32 format);
@@ -175,6 +176,11 @@ extern "C" DECLSPEC void SDLCALL Java_paulscode_android_mupen64plusae_jni_Native
// Clear stale error messages
dlerror();
// Find and call the JNI_OnUnLoad functions from the SDL2 library
pJNI_OnUnload JNI_OnUnLoad = (pJNI_OnUnload) locateFunction(handleSDL, "SDL2", "JNI_OnUnload");
JNI_OnUnLoad(mVm, mReserved);
JNI_OnUnLoad = NULL;
// Nullify function pointers so that they can no longer be used
aeiInit = NULL;
sdlInit = NULL;

1 comment on commit 1558520

@littleguy77

This comment has been minimized.

Show comment
Hide comment
@littleguy77

littleguy77 May 3, 2015

Member

@Gillou68310 Thanks! I cherry-picked this onto master. You can delete this branch now :)

Member

littleguy77 commented on 1558520 May 3, 2015

@Gillou68310 Thanks! I cherry-picked this onto master. You can delete this branch now :)

Please sign in to comment.