I'm trying to pass object pointer as long from C++ code to java method through JNI to convert it back to pointer in callback later.
void Client::process()
{
long thisAddress = (long)this;
QAndroidJniObject res = activity.callObjectMethod("process", "(Ljava/lang/Long;)Ljava/lang/String;", (jlong)thisAddress);
}
Java function prototype is public String process(Long clientAddr)
and here is beauty that JVM prints to me: Invalid indirect reference 0x5f3d9bc8 in decodeIndirectRef
.
What is wrong with this code? Or, maybe, there is another method to do what I want?