mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
delete JNI weak refs when the java object (LinphoneFriend or LinphoneChatMessage) is finalized.
This will avoid a periodic weak ref overflow.
This commit is contained in:
parent
9adce33173
commit
b6f74357e0
1 changed files with 8 additions and 0 deletions
|
|
@ -4191,7 +4191,11 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_finalize(JNIEnv* env
|
|||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
LinphoneFriend *lfriend=(LinphoneFriend*)ptr;
|
||||
jobject wref = (jobject)linphone_friend_get_user_data(lfriend);
|
||||
linphone_friend_set_user_data(lfriend,NULL);
|
||||
if (wref){
|
||||
env->DeleteWeakGlobalRef(wref);
|
||||
}
|
||||
linphone_friend_unref(lfriend);
|
||||
}
|
||||
|
||||
|
|
@ -4727,7 +4731,11 @@ extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setListener(JNIEn
|
|||
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_unref(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
jobject wref = (jobject)linphone_chat_message_get_user_data((LinphoneChatMessage*)ptr);
|
||||
linphone_chat_message_set_user_data((LinphoneChatMessage*)ptr, NULL);
|
||||
if (wref){
|
||||
env->DeleteWeakGlobalRef(wref);
|
||||
}
|
||||
linphone_chat_message_unref((LinphoneChatMessage*)ptr);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue