diff options
Diffstat (limited to 'java/direct_bt/tinyb/DBTNativeDownlink.java')
-rw-r--r-- | java/direct_bt/tinyb/DBTNativeDownlink.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/java/direct_bt/tinyb/DBTNativeDownlink.java b/java/direct_bt/tinyb/DBTNativeDownlink.java index 5e4e3a71..b0b87057 100644 --- a/java/direct_bt/tinyb/DBTNativeDownlink.java +++ b/java/direct_bt/tinyb/DBTNativeDownlink.java @@ -64,12 +64,22 @@ public abstract class DBTNativeDownlink return; } isValid = false; - clearNativeJavaObject(nativeInstance); + deleteNativeJavaObject(nativeInstance); deleteImpl(); nativeInstance = 0; } /** + * Called from native JavaUplink dtor -> JavaGlobalObj dtor, + * i.e. native instance destructed in native land. + */ + private synchronized void notifyDeleted() { + // System.err.println("***** notifyDeleted: "+getClass().getSimpleName()+": valid "+isValid+" -> false, handle 0x"+Long.toHexString(nativeInstance)+" -> null"); + isValid = false; + nativeInstance = 0; + } + + /** * Deletes the native instance. * <p> * Called via {@link #delete()} and at this point this java reference @@ -79,5 +89,5 @@ public abstract class DBTNativeDownlink protected abstract void deleteImpl(); private native void initNativeJavaObject(final long nativeInstance); - private native void clearNativeJavaObject(final long nativeInstance); + private native void deleteNativeJavaObject(final long nativeInstance); } |