Commit 44665fe8 authored by Sylvain Berfini's avatar Sylvain Berfini

Added implem of remove_listener in jni layer, fixing crash occuring on second call

parent d8ce5b89
......@@ -1032,7 +1032,21 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addListener(JNIEnv* env,
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeListener(JNIEnv* env, jobject thiz, jlong lc, jobject jlistener) {
MSList* iterator;
LinphoneCore *core = (LinphoneCore*)lc;
jobject listener = env->NewGlobalRef(jlistener);
for (iterator = core->vtables; iterator != NULL; iterator = iterator->next) {
LinphoneCoreVTable *vTable = (LinphoneCoreVTable*)(iterator->data);
if (vTable) {
LinphoneCoreData *data = (LinphoneCoreData*) linphone_core_v_table_get_user_data(vTable);
if (data && env->IsSameObject(data->listener, listener)) {
linphone_core_remove_listener(core, vTable);
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_migrateToMultiTransport(JNIEnv* env
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