Does JNI CallObjectMethod mask the stack frame?

I have C ++ code calling a Java method that returns an object:

virtual bool OnGetData(sf::SoundStream::Chunk& data) {
    jobject jchunk = env->CallObjectMethod(binding, JSoundStream::m_getData);
    if(jchunk) {
            //... some processing code will go here in the future
            return true;
    }
    return false;
}

This method lies inside the C ++ class, where bindingis a valid global reference to a Java object, and JSoundStream::m_getDatais the method identifier of the following method inside the following Java class:

public class TestStream extends JSoundStream {
    [...]

    @Override
    public Chunk getData() {
        return null; //testing
    }
}

I accidentally get access violations inside the JVM when this method is called from C ++. Sometimes it just works fine, sometimes I get an access violation. Deleting a string CallObjectMethodwill never cause it, so it should be a source of access violations. Inserting printfs for debugging purposes makes these access violations much more likely. This calls me: I'm pretty sure that something is spinning the stack of frames.

: ? . - , .

++ __cdecl ( ), JNI __stdcall, , , (MSV++ 2008) ) "", , . , ? , ?

+3
1

, env, . JVM , jvm->AttachCurrentThread(&env);, jvm.

+1

All Articles