diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-14 23:27:40 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-14 23:27:40 +0100 |
commit | b8e1d6585cb8f53ef2b7ae0c4cbdeb909436ff67 (patch) | |
tree | 1434c056407092fa0d2c5da0e6c6943afddaa4ab /modules/mono/editor/bindings_generator.cpp | |
parent | 6318320c04f348eee1df7a5dae3bad540ef1fdcc (diff) | |
parent | 833b252ce7772d94836588bcdc40dc221f8b83ef (diff) |
Merge pull request #69971 from neikeq/csharp-vararg-ret-premature-free
C#: Fix premature free of returned Variant in vararg methods
Diffstat (limited to 'modules/mono/editor/bindings_generator.cpp')
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 7ef42247d1..6559cbf75d 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -2489,9 +2489,12 @@ Error BindingsGenerator::_generate_cs_native_calls(const InternalCall &p_icall, if (!ret_void) { if (return_type->cname != name_cache.type_Variant) { + // Usually the return value takes ownership, but in this case the variant is only used + // for conversion to another return type. As such, the local variable takes ownership. r_output << "using godot_variant " << C_LOCAL_VARARG_RET " = "; } else { - r_output << "using godot_variant " << C_LOCAL_RET " = "; + // Variant's [c_out] takes ownership of the variant value + r_output << "godot_variant " << C_LOCAL_RET " = "; } } |