[Java] Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / LockableScore.java
index 30ba6409331be42db04c02525fcd628521969d4a..a8cc6788bd2e48d7c11af3d0856bea5ba51e9410 100644 (file)
@@ -30,7 +30,19 @@ public class LockableScore extends CommonBase {
        protected void finalize() throws Throwable {
                if (ptr != 0) { bindings.LockableScore_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.LockableScore_free(ptr); }
+               ptr = 0;
+       }
        public static interface LockableScoreInterface {
                /**
                 * Returns the locked scorer.
@@ -44,8 +56,8 @@ public class LockableScore extends CommonBase {
                        @Override public long lock() {
                                Score ret = arg.lock();
                                Reference.reachabilityFence(arg);
-                               long result = ret == null ? 0 : ret.ptr;
-                               impl_holder.held.ptrs_to.add(ret);
+                               long result = ret.ptr;
+                               if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); };
                                return result;
                        }
                });
@@ -59,7 +71,7 @@ public class LockableScore extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                Score ret_hu_conv = new Score(null, ret);
-               ret_hu_conv.ptrs_to.add(this);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }