feat: add config base free instead of user profile

This commit is contained in:
0x330a
2022-12-16 16:53:12 +11:00
parent bd2a4fcfd6
commit 1b2e734453
5 changed files with 44 additions and 11 deletions

View File

@@ -33,6 +33,12 @@ Java_network_loki_messenger_libsession_1util_ConfigBase_push(JNIEnv *env, jobjec
return returnObject;
}
JNIEXPORT void JNICALL
Java_network_loki_messenger_libsession_1util_ConfigBase_free(JNIEnv *env, jobject thiz) {
auto config = ptrToConfigBase(env, thiz);
delete config;
}
JNIEXPORT jbyteArray JNICALL
Java_network_loki_messenger_libsession_1util_ConfigBase_dump(JNIEnv *env, jobject thiz) {
auto config = ptrToConfigBase(env, thiz);

View File

@@ -54,12 +54,6 @@ Java_network_loki_messenger_libsession_1util_UserProfile_getName(JNIEnv *env, jo
return returnString;
}
JNIEXPORT void JNICALL
Java_network_loki_messenger_libsession_1util_UserProfile_free(JNIEnv *env, jobject thiz) {
auto profile = ptrToProfile(env, thiz);
delete profile;
}
JNIEXPORT jobject JNICALL
Java_network_loki_messenger_libsession_1util_UserProfile_getPic(JNIEnv *env, jobject thiz) {
auto profile = ptrToProfile(env, thiz);

View File

@@ -23,6 +23,14 @@ sealed class ConfigBase(protected val /* yucky */ pointer: Long) {
// Singular merge
external fun merge(toMerge: ByteArray): Int
external fun free()
@Override
fun finalize() {
free()
}
}
class Contacts(pointer: Long) : ConfigBase(pointer) {
@@ -53,7 +61,6 @@ class UserProfile(pointer: Long) : ConfigBase(pointer) {
external fun setName(newName: String)
external fun getName(): String?
external fun free()
external fun getPic(): UserPic?
external fun setPic(userPic: UserPic)
}