Merge pull request #90710 from m4gr3d/fix_jstring_leaks

Fix leakage of JNI object references
This commit is contained in:
Rémi Verschelde 2024-04-22 12:52:16 +02:00
commit 8c474ddd49
No known key found for this signature in database
GPG key ID: C3336907360768E1
20 changed files with 139 additions and 32 deletions

View file

@ -35,9 +35,13 @@
#include <android/asset_manager.h>
#include <android/log.h>
#include <jni.h>
#include <stdio.h>
class FileAccessAndroid : public FileAccess {
static AAssetManager *asset_manager;
static jobject j_asset_manager;
mutable AAsset *asset = nullptr;
mutable uint64_t len = 0;
mutable uint64_t pos = 0;
@ -48,8 +52,6 @@ class FileAccessAndroid : public FileAccess {
void _close();
public:
static AAssetManager *asset_manager;
virtual Error open_internal(const String &p_path, int p_mode_flags) override; // open a file
virtual bool is_open() const override; // true when file is open
@ -93,6 +95,10 @@ public:
virtual void close() override;
static void setup(jobject p_asset_manager);
static void terminate();
~FileAccessAndroid();
};