1 Reply Latest reply on Jul 1, 2011 12:47 AM by EJP

    Can weak global references become invalid during code execution?


      Currently I have the following code, imgBuffer is a weak global refernce:

      if(!(*env)->IsSameObject(env, imgBuffer, NULL)) {
      ... use imgBuffer reference

      Is the following code invalid, because the reference could become invalid after the null-check?
      If this is the case, do I need to create a new local reference first, and use that one instead?

      Or are there some guarantees that weak global references aren't collected as long as native code is executed?

      Thanks, Clemens