Commit 0b95c162 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Real fix for Java wrapper's listeners

parent 471c5b3d
......@@ -591,7 +591,8 @@ class JniInterface(object):
def __init__(self, javaClass, apiClass):
self.isSingleListener = (not apiClass.multilistener)
self.isMultiListener = (apiClass.multilistener)
self.classCName = javaClass.className
self.className = javaClass.className
self.classCName = javaClass.cName
self.cPrefix = javaClass.cPrefix
self.callbacks = []
listener = apiClass.listenerInterface
......@@ -694,6 +695,7 @@ class Jni(object):
'isSingleListener': jniInterface.isSingleListener,
'isMultiListener': jniInterface.isMultiListener,
'classCName': jniInterface.classCName,
'className': jniInterface.className,
'cPrefix': jniInterface.cPrefix,
'jniPackage': self.jni_package,
'factoryName': javaClass.factoryName,
......
......@@ -234,10 +234,10 @@ static {{return}} {{callbackName}}({{params}}) {
{{#interfaces}}
{{#isSingleListener}}
void {{jniPackage}}{{classCName}}Impl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
void {{jniPackage}}{{className}}Impl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
{{/isSingleListener}}
{{#isMultiListener}}
void {{jniPackage}}{{classCName}}Impl_addListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
void {{jniPackage}}{{className}}Impl_addListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
{{/isMultiListener}}
{{classCName}} *cptr = ({{classCName}}*)ptr;
jobject listener = env->NewGlobalRef(jlistener);
......@@ -257,7 +257,7 @@ void {{jniPackage}}{{classCName}}Impl_addListener(JNIEnv* env, jobject thiz, jlo
}
{{#isMultiListener}}
void {{jniPackage}}{{classCName}}Impl_removeListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
void {{jniPackage}}{{className}}Impl_removeListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
{{classCName}} *cptr = ({{classCName}}*)ptr;
const bctbx_list_t *cbs_list = {{cPrefix}}_get_callbacks_list(cptr);
bctbx_list_t *it;
......
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