From: Matt Corallo Date: Tue, 17 Aug 2021 22:15:55 +0000 (+0000) Subject: Fix cloning trait structs via native clone method X-Git-Tag: v0.0.100.0~3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=43c61db973ad9947d5369e5a115202d78e147a82;p=ldk-java Fix cloning trait structs via native clone method When cloning a trait struct, we need to reference the already-converted-to-struct value, not the original, integer, value. --- diff --git a/gen_type_mapping.py b/gen_type_mapping.py index 6cf389aa..ab95f9b6 100644 --- a/gen_type_mapping.py +++ b/gen_type_mapping.py @@ -297,7 +297,7 @@ class TypeMappingGenerator: if not is_free: needs_full_clone = not is_free and (not ty_info.is_ptr and not holds_ref or ty_info.requires_clone == True) and ty_info.requires_clone != False if needs_full_clone and (ty_info.rust_obj.replace("LDK", "") + "_clone") in self.clone_fns: - base_conv = base_conv + "\n" + ty_info.var_name + "_conv = " + ty_info.rust_obj.replace("LDK", "") + "_clone(" + ty_info.var_name + ");" + base_conv = base_conv + "\n" + ty_info.var_name + "_conv = " + ty_info.rust_obj.replace("LDK", "") + "_clone(&" + ty_info.var_name + "_conv);" else: base_conv = base_conv + self.consts.trait_struct_inc_refcnt(ty_info) if needs_full_clone: