diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index a73492274..74c701a72 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -29,7 +29,7 @@ class LinphoneCallImpl implements LinphoneCall { private native boolean isIncoming(long nativePtr); native private long getRemoteAddress(long nativePtr); native private int getState(long nativePtr); - private native long getCurrentParams(long nativePtr); + private native long getCurrentParamsCopy(long nativePtr); private native void enableCamera(long nativePtr, boolean enabled); protected LinphoneCallImpl(long aNativePtr) { @@ -61,11 +61,8 @@ class LinphoneCallImpl implements LinphoneCall { public State getState() { return LinphoneCall.State.fromInt(getState(nativePtr)); } - public LinphoneCallParams getCurrentParamsReadOnly() { - return new LinphoneCallParamsImpl(getCurrentParams(nativePtr)); - } - public LinphoneCallParams getCurrentParamsReadWrite() { - return getCurrentParamsReadOnly().copy(); + public LinphoneCallParams getCurrentParamsCopy() { + return new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); } public void enableCamera(boolean enabled) { diff --git a/LinphoneCallParamsImpl.java b/LinphoneCallParamsImpl.java index 1242ee996..33d460697 100644 --- a/LinphoneCallParamsImpl.java +++ b/LinphoneCallParamsImpl.java @@ -27,7 +27,7 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native void enableVideo(long nativePtr, boolean b); private native boolean getVideoEnabled(long nativePtr); - private native long copy(long nativePtr); + private native void destroy(long nativePtr); public boolean getVideoEnabled() { @@ -37,9 +37,10 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public void setVideoEnabled(boolean b) { enableVideo(nativePtr, b); } - - public LinphoneCallParams copy() { - return new LinphoneCallParamsImpl(copy(nativePtr)); + + @Override + protected void finalize() throws Throwable { + destroy(nativePtr); + super.finalize(); } - }