diff options
| author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2011-03-11 18:34:35 +0000 |
|---|---|---|
| committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2011-03-11 18:34:35 +0000 |
| commit | 66f2a08f8a37933b9eff79ceabdc2cb42706e48c (patch) | |
| tree | 704cd88300e33a99335adf1d5e3e4ff6b71a2aed /apps/hosted/android/yesno.c | |
| parent | 2e5b7aebde6426058ea7b69424b0335a844a6a18 (diff) | |
| download | rockbox-66f2a08f8a37933b9eff79ceabdc2cb42706e48c.zip rockbox-66f2a08f8a37933b9eff79ceabdc2cb42706e48c.tar.gz rockbox-66f2a08f8a37933b9eff79ceabdc2cb42706e48c.tar.bz2 rockbox-66f2a08f8a37933b9eff79ceabdc2cb42706e48c.tar.xz | |
Android: Don't share the JNI environment across threads, but obtain it the
correct way
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29569 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/hosted/android/yesno.c')
| -rw-r--r-- | apps/hosted/android/yesno.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/hosted/android/yesno.c b/apps/hosted/android/yesno.c index 7aca3f7..de6ec99 100644 --- a/apps/hosted/android/yesno.c +++ b/apps/hosted/android/yesno.c @@ -28,8 +28,8 @@ #include "settings.h" #include "lang.h" #include "kernel.h" +#include "system.h" -extern JNIEnv *env_ptr; static jobject RockboxYesno_instance = NULL; static jmethodID yesno_func; static struct semaphore yesno_done; @@ -44,7 +44,7 @@ Java_org_rockbox_RockboxYesno_put_1result(JNIEnv *env, jobject this, jboolean re semaphore_release(&yesno_done); } -static void yesno_init(void) +static void yesno_init(JNIEnv *env_ptr) { JNIEnv e = *env_ptr; static jmethodID yesno_is_usable; @@ -75,7 +75,7 @@ static void yesno_init(void) sleep(HZ/10); } -jstring build_message(const struct text_message *message) +static jstring build_message(JNIEnv *env_ptr, const struct text_message *message) { char msg[1024] = ""; JNIEnv e = *env_ptr; @@ -99,10 +99,12 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, { (void)yes_message; (void)no_message; - yesno_init(); - + JNIEnv *env_ptr = getJavaEnvironment(); + + yesno_init(env_ptr); + JNIEnv e = *env_ptr; - jstring message = build_message(main_message); + jstring message = build_message(env_ptr, main_message); jstring yes = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_YES)); jstring no = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_NO)); |