]> sjero.net Git - linphone/commitdiff
Take a reference on the Android display window on set.
authorGuillaume Beraudo <guillaume.beraudo@linphone.org>
Wed, 12 Oct 2011 12:00:16 +0000 (14:00 +0200)
committerGuillaume Beraudo <guillaume.beraudo@linphone.org>
Wed, 12 Oct 2011 12:01:59 +0000 (14:01 +0200)
coreapi/linphonecore_jni.cc

index 2e2df6d422a86d62f89c2fff12b5f539edb615b9..d351c77a839b19ee873ad4253dbcb5bc98587dbf 100644 (file)
@@ -1191,6 +1191,13 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv*
                                                                                                                                                ,jobject thiz
                                                                                                                                                ,jlong lc
                                                                                                                                                ,jobject obj) {
+       jobject oldWindow = (jobject) linphone_core_get_native_video_window_id((LinphoneCore*)lc);
+       if (oldWindow != NULL) {
+               env->DeleteGlobalRef(oldWindow);
+       }
+       if (obj != NULL) {
+               obj = env->NewGlobalRef(obj);
+       }
        linphone_core_set_native_video_window_id((LinphoneCore*)lc,(unsigned long)obj);
 }