title: CallLongMethod JNI Android SIGSEGV
body: <p>First of all, thank you for your time and help.</p>
  
  <p>I'm making an Android + JNI app that tries to reach a 10 position array of Mat (openCV type).
  I'm following this tutorial: <a href="https://stackoverflow.com/questions/16012115/pass-an-array-of-mats-to-native-code/17664292#17664292">Pass an array of Mats to native code</a> </p>
  
  <p>But when I get at the "CallLongMethod" line, it throws a SIGSEGV error. I've checked and non of the pointers (getPtrMethod, bufimgsfieldid, bufimgsArray) are 0. The code is here:</p>
  
  <pre><code>jmethodID getPtrMethod = env-&gt;GetMethodID(matclass, "getNativeObjAddr", "()J");
  jfieldID bufimgsfieldid = env-&gt;GetFieldID(thisclass, "bufImgs", "[Lorg/opencv/core/Mat;");
  jobjectArray bufimgsArray = (jobjectArray)env-&gt;GetObjectField(thisobject, bufimgsfieldid);
  
  Mat* nativeBufImgs = new Mat[10];
  LOGD("Creation Passed");
  for (int i = 0; i &lt; 10; i++) {
      LOGD("Makint the  %i", i);
      nativeBufImgs[i] = *(Mat*)env-&gt;CallLongMethod(env-&gt;GetObjectArrayElement(bufimgsArray, i), getPtrMethod);
  }
  </code></pre>
  
  <p>Any idea of whats going wrong?</p>