utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
562 stars 38 forks source link

Improve Env class and its uses #597

Closed CedNaru closed 3 months ago

CedNaru commented 3 months ago

I fixed an issue with the Env stored in the Jvm not being thread dependent, which could cause memory leak when multithread was used. On top of that. I removed as many jni::Jvm::current_env() as possible. Opting to pass its reference to the deepest part of the api. Most calls to that function now are going to be in the overridden Godot methods (like in Script or ScriptInstance). I couldn't remove the use of it in destructors as they have no parameters.