mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 12:08:11 +00:00
Fix & workaround for Android's Java wrapper
This commit is contained in:
parent
45a015e40b
commit
a633dac8aa
2 changed files with 8 additions and 4 deletions
|
|
@ -391,6 +391,10 @@ class JavaTranslator(object):
|
|||
methodDict['name'] = 'Java_' + self.jni_package + className.to_camel_case() + 'Impl_' + _method.name.to_camel_case(lower=True)
|
||||
methodDict['notStatic'] = not static
|
||||
methodDict['c_name'] = 'linphone_' + className.to_snake_case() + "_" + _method.name.to_snake_case()
|
||||
if _method.name.to_snake_case() == 'create_core':
|
||||
methodDict['c_name'] = 'linphone_' + className.to_snake_case() + "_" + 'create_core_3'
|
||||
elif _method.name.to_snake_case() == 'create_core_with_config':
|
||||
methodDict['c_name'] = 'linphone_' + className.to_snake_case() + "_" + 'create_core_with_config_3'
|
||||
methodDict['returnObject'] = methodDict['hasReturn'] and type(_method.returnType) is AbsApi.ClassType
|
||||
methodDict['returnClassName'] = self.translate_type(_method.returnType)
|
||||
methodDict['isRealObjectArray'] = False
|
||||
|
|
@ -435,7 +439,7 @@ class JavaTranslator(object):
|
|||
classCName = 'Linphone' + arg.type.desc.name.to_camel_case()
|
||||
if classCName[-8:] == 'Listener':
|
||||
classCName = 'Linphone' + arg.type.desc.name.to_camel_case()[:-8] + 'Cbs'
|
||||
methodDict['objects'].append({'object': argname, 'objectClassCName': classCName})
|
||||
methodDict['objects'].append({'object': argname, 'objectClassCName': classCName, 'refCountable': arg.type.desc.refcountable})
|
||||
methodDict['params_impl'] += 'c_' + argname
|
||||
|
||||
elif type(arg.type) is AbsApi.ListType:
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ jobject get{{className}}(JNIEnv *env, {{classCName}} *cptr) {
|
|||
if (up == NULL) {
|
||||
jobj = env->NewObject({{cPrefix}}_class, {{cPrefix}}_constructor, (jlong)cptr);
|
||||
belle_sip_object_data_set((belle_sip_object_t *)cptr, belle_sip_java_user_data_key, (void*)env->NewWeakGlobalRef(jobj), NULL);
|
||||
{{cPrefix}}_ref(cptr);
|
||||
{{#refCountable}}{{cPrefix}}_ref(cptr);{{/refCountable}}
|
||||
} else {
|
||||
jobj = env->NewLocalRef((jobject)up);
|
||||
if (jobj == NULL) {
|
||||
|
|
@ -252,7 +252,7 @@ jobject get{{className}}(JNIEnv *env, {{classCName}} *cptr) {
|
|||
// takes implicit local ref
|
||||
jobj = env->NewObject({{cPrefix}}_class, {{cPrefix}}_constructor, (jlong)cptr);
|
||||
belle_sip_object_data_set((belle_sip_object_t *)cptr, belle_sip_java_user_data_key, (void*)env->NewWeakGlobalRef(jobj), NULL);
|
||||
{{cPrefix}}_ref(cptr);
|
||||
{{#refCountable}}{{cPrefix}}_ref(cptr);{{/refCountable}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -266,7 +266,7 @@ void Java_{{jniPrefix}}{{classImplName}}_unref(JNIEnv* env, jobject thiz, jlong
|
|||
if (wref) {
|
||||
env->DeleteWeakGlobalRef(wref);
|
||||
}
|
||||
{{cPrefix}}_unref(cptr);
|
||||
{{#refCountable}}{{cPrefix}}_unref(cptr);{{/refCountable}}
|
||||
}
|
||||
|
||||
{{/objects}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue