Commit a2bf48f6 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Do not use Java's nativePtr for Factory

parent 2c56bf14
......@@ -366,6 +366,7 @@ class JavaTranslator(object):
methodDict['classCName'] = 'Linphone' + className.to_camel_case()
methodDict['className'] = className.to_camel_case()
methodDict['classImplName'] = className.to_camel_case() + 'Impl'
methodDict['isLinphoneFactory'] = className.to_camel_case() == 'Factory'
methodDict['jniPath'] = self.jni_path
methodDict['return'] = self.translate_type(_method.returnType, jni=True, isReturn=True)
......
......@@ -85,7 +85,7 @@ public {{#isLinphoneFactory}}abstract class{{/isLinphoneFactory}}{{#isNotLinphon
public static final synchronized Factory instance() {
try {
if (_Factory == null) {
_Factory = new FactoryImpl(0);
_Factory = new FactoryImpl(0); // This value is not relevant, correct factory pointer will be used in JNI layer
}
} catch (Exception e) {
System.err.println("Cannot instanciate factory");
......
......@@ -426,7 +426,9 @@ jobject Java_{{jni_package}}FactoryImpl_createCore(JNIEnv *env, jobject thiz, jo
{{#methods}}
{{#notEmpty}}
{{return}} {{name}}({{params}}) {
{{#notStatic}}{{classCName}} *cptr = ({{classCName}}*)ptr;{{/notStatic}}{{#strings}}
{{#notStatic}}{{classCName}} *cptr = ({{classCName}}*)ptr;
{{#isLinphoneFactory}}cptr = linphone_factory_get();{{/isLinphoneFactory}}
{{/notStatic}}{{#strings}}
const char* c_{{string}} = GetStringUTFChars(env, {{string}});
{{/strings}}{{#bytes}}
{{bytesargtype}} c_{{bytesargname}} = ({{bytesargtype}})env->GetByteArrayElements({{bytesargname}}, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment