Merge pull request #798 from Faless/fix/4.x_no_memnew_cb

pull/799/head
Rémi Verschelde 2022-07-29 13:51:05 +02:00 committed by GitHub
commit 54e1385729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -165,9 +165,12 @@ public:
} \
\
static void *___binding_create_callback(void *p_token, void *p_instance) { \
return memnew(m_class((GodotObject *)p_instance)); \
/* Do not call memnew here, we don't want the postinitializer to be called */ \
return new ("") m_class((GodotObject *)p_instance); \
} \
static void ___binding_free_callback(void *p_token, void *p_instance, void *p_binding) { \
/* Explicitly call the deconstructor to ensure proper lifecycle for non-trivial members */ \
reinterpret_cast<m_class *>(p_binding)->~m_class(); \
Memory::free_static(reinterpret_cast<m_class *>(p_binding)); \
} \
static GDNativeBool ___binding_reference_callback(void *p_token, void *p_instance, GDNativeBool p_reference) { \