diff --git a/LinphoneCallImpl.java b/LinphoneCallImpl.java index db8b3f733..ceb541ed0 100644 --- a/LinphoneCallImpl.java +++ b/LinphoneCallImpl.java @@ -23,8 +23,7 @@ class LinphoneCallImpl implements LinphoneCall { protected final long nativePtr; boolean ownPtr = false; - native private void ref(long ownPtr); - native private void unref(long ownPtr); + native private void finalize(long nativePtr); native private long getCallLog(long nativePtr); private native boolean isIncoming(long nativePtr); native private long getRemoteAddress(long nativePtr); @@ -46,10 +45,9 @@ class LinphoneCallImpl implements LinphoneCall { protected LinphoneCallImpl(long aNativePtr) { nativePtr = aNativePtr; - ref(nativePtr); } protected void finalize() throws Throwable { - unref(nativePtr); + finalize(nativePtr); } public LinphoneCallLog getCallLog() { long lNativePtr = getCallLog(nativePtr); diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 01517762d..52019f96b 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -65,7 +65,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr); - private native long getCurrentCall(long nativePtr) ; + private native Object getCurrentCall(long nativePtr) ; private native void playDtmf(long nativePtr,char dtmf,int duration); private native void stopDtmf(long nativePtr); private native void setVideoWindowId(long nativePtr, Object wid); @@ -285,12 +285,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized LinphoneCall getCurrentCall() { isValid(); - long lNativePtr = getCurrentCall(nativePtr); - if (lNativePtr!=0) { - return new LinphoneCallImpl(lNativePtr); - } else { - return null; - } + return (LinphoneCall)getCurrentCall(nativePtr); } public int getPlayLevel() { @@ -554,5 +549,4 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub } - }