diff options
Diffstat (limited to 'libs/samba/src/main/cpp/samba.cpp')
| -rw-r--r-- | libs/samba/src/main/cpp/samba.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/samba/src/main/cpp/samba.cpp b/libs/samba/src/main/cpp/samba.cpp index 1d1d9d2..1e6b425 100644 --- a/libs/samba/src/main/cpp/samba.cpp +++ b/libs/samba/src/main/cpp/samba.cpp @@ -260,6 +260,12 @@ void RegisterSamba(JNIEnv* env) { g_DirEntryClass = dir_entry_clazz; } +void UnregisterSamba() { + g_CreateDirEntry = 0; + g_NativeSambaClass.reset(); + g_DirEntryClass.reset(); +} + jni::LocalRef<jobject> CreateDirEntry(JNIEnv* env, const std::string& name, const smb2_stat_64& stat) { auto j_name = jni::UTF8ToString(env, name); // Kotlin size casts Long to ULong @@ -292,3 +298,8 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) { return jni::JNI_VERSION; } + +void JNI_OnUnload(JavaVM *vm, void *reserved) { + // Not called on Android (or in general), but if it where, this would be the place to unregister. + UnregisterSamba(); +} |
