[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / src / main / java / org / ldk / structs / Listen.java
index a74c118df99d4aa79f7145b48260a8cab4598aeb..ada394d95c1f13fc8b3691b301207955e2260f14 100644 (file)
@@ -33,7 +33,19 @@ public class Listen extends CommonBase {
        protected void finalize() throws Throwable {
                if (ptr != 0) { bindings.Listen_free(ptr); } super.finalize();
        }
-
+       /**
+        * Destroys the object, freeing associated resources. After this call, any access
+        * to this object may result in a SEGFAULT or worse.
+        *
+        * You should generally NEVER call this method. You should let the garbage collector
+        * do this for you when it finalizes objects. However, it may be useful for types
+        * which represent locks and should be closed immediately to avoid holding locks
+        * until the GC runs.
+        */
+       public void destroy() {
+               if (ptr != 0) { bindings.Listen_free(ptr); }
+               ptr = 0;
+       }
        public static interface ListenInterface {
                /**
                 * Notifies the listener that a block was added at the given height, with the transaction data
@@ -59,7 +71,7 @@ public class Listen extends CommonBase {
                                for (int c = 0; c < txdata_conv_28_len; c++) {
                                        long txdata_conv_28 = txdata[c];
                                        TwoTuple_usizeTransactionZ txdata_conv_28_hu_conv = new TwoTuple_usizeTransactionZ(null, txdata_conv_28);
-                                       txdata_conv_28_hu_conv.ptrs_to.add(this);
+                                       if (txdata_conv_28_hu_conv != null) { txdata_conv_28_hu_conv.ptrs_to.add(this); };
                                        txdata_conv_28_arr[c] = txdata_conv_28_hu_conv;
                                }
                                arg.filtered_block_connected(header, txdata_conv_28_arr, height);
@@ -81,7 +93,7 @@ public class Listen extends CommonBase {
         * possibly filtered.
         */
        public void filtered_block_connected(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height) {
-               bindings.Listen_filtered_block_connected(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height);
+               bindings.Listen_filtered_block_connected(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28.ptr).toArray() : null, height);
                Reference.reachabilityFence(this);
                Reference.reachabilityFence(header);
                Reference.reachabilityFence(txdata);