From b70af097a9088982656824c1a42d3cc1b5d6734e Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 12 May 2024 14:47:29 +0000 Subject: [PATCH] Add a new `force_free` in Java for cases where its useful --- java_strings.py | 3 +++ 1 file changed, 3 insertions(+) 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" -- 2.39.5