summaryrefslogtreecommitdiffstats
path: root/modules/mono/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-26 11:47:25 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-26 11:47:25 +0100
commit563e3858104da5c99e2bbaf0af3525e4db1e4e28 (patch)
treefcd609bae26b635dcb7be36fc6e90c80778adce5 /modules/mono/editor
parent73419e645b136728032e2326f4e7b31a0cca67d2 (diff)
parent201e9467410ea331c1a40bbd7457aef1acedbe34 (diff)
downloadredot-engine-563e3858104da5c99e2bbaf0af3525e4db1e4e28.tar.gz
Merge pull request #87526 from zaevi/fix_csharp_gc
C#: Fix incorrect GC handle for non-instantiable types.
Diffstat (limited to 'modules/mono/editor')
-rw-r--r--modules/mono/editor/bindings_generator.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 58071e338b..675651ccf7 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -1621,9 +1621,13 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
<< CLOSE_BLOCK_L2 CLOSE_BLOCK_L1;
} else {
// Hide the constructor
- output.append(MEMBER_BEGIN "internal ");
- output.append(itype.proxy_name);
- output.append("() {}\n");
+ output << MEMBER_BEGIN "internal " << itype.proxy_name << "() : this("
+ << (itype.memory_own ? "true" : "false") << ")\n" OPEN_BLOCK_L1
+ << INDENT2 "unsafe\n" INDENT2 OPEN_BLOCK
+ << INDENT3 "_ConstructAndInitialize(null, "
+ << BINDINGS_NATIVE_NAME_FIELD ", CachedType, refCounted: "
+ << (itype.is_ref_counted ? "true" : "false") << ");\n"
+ << CLOSE_BLOCK_L2 CLOSE_BLOCK_L1;
}
// Add.. em.. trick constructor. Sort of.