From: Matt Corallo Date: Sun, 12 May 2024 14:47:29 +0000 (+0000) Subject: Add a new `force_free` in Java for cases where its useful X-Git-Tag: v0.0.123.0^2~10 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=b70af097a9088982656824c1a42d3cc1b5d6734e;p=ldk-java Add a new `force_free` in Java for cases where its useful --- diff --git a/java_strings.py b/java_strings.py index c99e8312..7e35d175 100644 --- a/java_strings.py +++ b/java_strings.py @@ -1418,6 +1418,9 @@ import javax.annotation.Nullable; java_hu_struct += "\tprotected void finalize() throws Throwable {\n" java_hu_struct += "\t\tif (ptr != 0) { bindings." + struct_name.replace("LDK","") + "_free(ptr); } super.finalize();\n" java_hu_struct += "\t}\n\n" + java_hu_struct += "\tprotected void force_free() {\n" # Used by NioPeerHandler + java_hu_struct += "\t\tif (ptr != 0) { bindings." + struct_name.replace("LDK","") + "_free(ptr); ptr = 0; }\n" + java_hu_struct += "\t}\n\n" java_hu_struct += "\tstatic " + human_ty + " constr_from_ptr(long ptr) {\n" java_hu_struct += "\t\tif (bindings." + struct_name.replace("LDK", "") + "_is_ok(ptr)) {\n" java_hu_struct += "\t\t\treturn new " + human_ty + "_OK(null, ptr);\n"