summaryrefslogtreecommitdiffstats
path: root/modules/mono/editor
diff options
context:
space:
mode:
authorZae <zaevi@live.com>2024-01-25 02:40:08 +0800
committerZae <zaevi@live.com>2024-01-25 02:40:08 +0800
commit201e9467410ea331c1a40bbd7457aef1acedbe34 (patch)
tree6dea5ba3f1db52fd70d2179eedad9e2de78b239a /modules/mono/editor
parent0bcc0e92b3f0ac57d4c4650722f347593a258572 (diff)
downloadredot-engine-201e9467410ea331c1a40bbd7457aef1acedbe34.tar.gz
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 25a5720bc4..41d05dfdd0 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.