Commit dab5cc72 authored by François Grisez's avatar François Grisez
Browse files

Fixes JNI crashes around LinphoneConference.getParticipants()

parent 804fd8a0
......@@ -6746,20 +6746,20 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getNortpTimeout(J
JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) {
JNIEXPORT jobjectArray JNICALL Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) {
MSList *participants, *it;
jclass addr_class = env->FindClass("org/linphone/core/LinphoneAddressImpl");
jclass addr_list_class = env->FindClass("[Lorg/linphone/core/LinphoneAddressImpl;");
jmethodID addr_constructor = env->GetMethodID(addr_class, "<init>", "(J)");
jmethodID addr_list_constructor = env->GetMethodID(addr_list_class, "<init>", "(V)");
jmethodID addr_list_append = env->GetMethodID(addr_list_class, "add", "(Lorg/linphone/core/LinphoneAddressImpl;)Z");
jobject jaddr_list = env->NewObject(addr_list_class, addr_list_constructor);
jobjectArray jaddr_list;
int i;
participants = linphone_conference_get_participants((LinphoneConference *)pconference);
for(it = participants; it; it = ms_list_next(it)) {
jaddr_list = env->NewObjectArray(ms_list_size(participants), addr_class, NULL);
for(it=participants, i=0; it; it=ms_list_next(it), i++) {
LinphoneAddress *addr = (LinphoneAddress *)it->data;
jobject jaddr = env->NewObject(addr_class, addr_constructor, addr);
env->CallBooleanMethod(jaddr_list, addr_list_append, jaddr);
env->SetObjectArrayElement(jaddr_list, i, jaddr);
}
return jaddr_list;
}
......
......@@ -29,7 +29,7 @@ public interface LinphoneConference {
/**
* Get the URIs of all participants of the conference
*/
public List<LinphoneAddress> getParticipants();
public LinphoneAddress[] getParticipants();
/**
* Remove a participant from the conference
* @param uri The URI of the participant to remove
......
......@@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package org.linphone.core;
import org.linphone.core.LinphoneConference;
import java.util.List;
public class LinphoneConferenceImpl implements LinphoneConference {
private final long nativePtr;
......@@ -30,8 +29,8 @@ public class LinphoneConferenceImpl implements LinphoneConference {
this.nativePtr = nativePtr;
}
private native List<LinphoneAddress> getParticipants(long nativePtr);
public List<LinphoneAddress> getParticipants() {
private native LinphoneAddress[] getParticipants(long nativePtr);
public LinphoneAddress[] getParticipants() {
return getParticipants(nativePtr);
}
......
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