summaryrefslogtreecommitdiff
path: root/navit/speech
diff options
context:
space:
mode:
authorrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-04-23 18:46:09 +0000
committerrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-04-23 18:46:09 +0000
commit78800269a518fd3f792f00979ee6ade36a975aab (patch)
tree53fab91da33fc22885c541f192fcb505fac833aa /navit/speech
parent117bd3ce5ec2a143f4735403d53792a165ac14b8 (diff)
downloadnavit-78800269a518fd3f792f00979ee6ade36a975aab.tar.gz
Fix:Android:Fix global JNI references (fix crashes with target API 15)
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5036 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/speech')
-rw-r--r--navit/speech/android/speech_android.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/navit/speech/android/speech_android.c b/navit/speech/android/speech_android.c
index d3834838a..c7d056bbf 100644
--- a/navit/speech/android/speech_android.c
+++ b/navit/speech/android/speech_android.c
@@ -102,23 +102,23 @@ speech_android_init(struct speech_priv *ret)
if (!android_find_class_global(class, &ret->NavitSpeechClass)) {
dbg(0,"No class found\n");
- return 0;
+ return 0;
+ }
+ dbg(0,"at 3\n");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitSpeechClass, "<init>", "(Lorg/navitproject/navit/Navit;)V");
+ if (cid == NULL) {
+ dbg(0,"no method found\n");
+ return 0; /* exception thrown */
}
- dbg(0,"at 3\n");
- cid = (*jnienv)->GetMethodID(jnienv, ret->NavitSpeechClass, "<init>", "(Lorg/navitproject/navit/Navit;)V");
- if (cid == NULL) {
- dbg(0,"no method found\n");
- return 0; /* exception thrown */
- }
if (!android_find_method(ret->NavitSpeechClass, "say", "(Ljava/lang/String;)V", &ret->NavitSpeech_say))
- return 0;
- dbg(0,"at 4 android_activity=%p\n",android_activity);
- ret->NavitSpeech=(*jnienv)->NewObject(jnienv, ret->NavitSpeechClass, cid, android_activity);
- dbg(0,"result=%p\n",ret->NavitSpeech);
+ return 0;
+ dbg(0,"at 4 android_activity=%p\n",android_activity);
+ ret->NavitSpeech=(*jnienv)->NewObject(jnienv, ret->NavitSpeechClass, cid, android_activity);
+ dbg(0,"result=%p\n",ret->NavitSpeech);
if (!ret->NavitSpeech)
return 0;
- if (ret->NavitSpeech)
- (*jnienv)->NewGlobalRef(jnienv, ret->NavitSpeech);
+ if (ret->NavitSpeech)
+ ret->NavitSpeech = (*jnienv)->NewGlobalRef(jnienv, ret->NavitSpeech);
return 1;
}