You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bridj (0.7-SNAPSHOT) Native method overriden in CPPObject broken #534
Sometimes, Java callback from CPP invocation (override a native method with a non-native method in a class extending CPPObject ) throws NullPointerException because BridJ.getJavaObjectForNativePointer return null in native code (CPPToJavaCallHandler_Sub)
getJavaObjectForNativePointer try to find a NativeObject instance in a WeakHashMap<Long,NativeObject> (knownNativeObjects field in BridJ). It's odd to use Long as weak key. They are garbaged very quickly so a null pointer is thrown because NativeObject instance couldn't be found.
Thanks a lot for taking the time to diagnose the problem and to find a fix!
In retrospect it was a silly design mistake to use a weak hashmap for this, so I've gone for another simpler route... It's in the fresh 0.7.0 release, please let me know if you face any issue with it!
Activity
BridJ: simplify weak hash map nonsense (fixes issue #534)
ochafik commentedon Mar 9, 2015
Hi @obethery ,
Thanks a lot for taking the time to diagnose the problem and to find a fix!
In retrospect it was a silly design mistake to use a weak hashmap for this, so I've gone for another simpler route... It's in the fresh 0.7.0 release, please let me know if you face any issue with it!
Cheers