Simplify Java/JNI local objects life cycle
Describe the bug In the Java bindings, many local objects are allocated and released manually, introducing potential memory leaks if not careful.
It's especially true for strings where we write things like this in different places:
const char* rawStr = env->GetStringUTFChars(str, nullptr);
// do something
env->ReleaseStringUTFChars(str, rawStr);
We should rely on RAII helpers instead.
Expected behavior
We should never allocate/release outside of the RAII helpers.
Related files in java directory.
Additional context This needs to be merged first: https://github.com/f3d-app/f3d/pull/3333
I'd like to take this after #3333 is merged.
Unassinged as discussed.
Hey @mwestphal is someone working on this? if not can you assign me this?
Assigned!