@@ -105,10 +105,6 @@ class Wrapped {
105105 static GDExtensionBool validate_property_bind (GDExtensionClassInstancePtr p_instance, GDExtensionPropertyInfo *p_property) { return false ; }
106106 static void to_string_bind (GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out) {}
107107
108- // The only reason this has to be held here, is when we return results of `_get_property_list` to Godot, we pass
109- // pointers to strings in this list. They have to remain valid to pass the bridge, until the list is freed by Godot...
110- ::godot::List<::godot::PropertyInfo> plist_owned;
111-
112108 void _postinitialize ();
113109
114110 Wrapped (const StringName &p_godot_class);
@@ -155,7 +151,7 @@ _FORCE_INLINE_ Vector<StringName> snarray(P... p_args) {
155151
156152namespace internal {
157153
158- GDExtensionPropertyInfo *create_c_property_list (const ::godot::List<::godot::PropertyInfo> & plist_cpp, uint32_t *r_size);
154+ GDExtensionPropertyInfo *create_c_property_list (::godot::List<::godot::PropertyInfo> * plist_cpp, uint32_t *r_size);
159155void free_c_property_list (GDExtensionPropertyInfo *plist);
160156
161157typedef void (*EngineClassRegistrationCallback)();
@@ -316,16 +312,14 @@ public:
316312 return nullptr ; \
317313 } \
318314 m_class *cls = reinterpret_cast <m_class *>(p_instance); \
319- ::godot::List<::godot::PropertyInfo> &plist_cpp = cls->plist_owned ; \
320- ERR_FAIL_COND_V_MSG (!plist_cpp.is_empty (), nullptr , " Internal error, property list was not freed by engine!" ); \
321- cls->_get_property_list (&plist_cpp); \
315+ ::godot::List<::godot::PropertyInfo> *plist_cpp = memnew (::godot::List<::godot::PropertyInfo>); \
316+ cls->_get_property_list (plist_cpp); \
322317 return ::godot::internal::create_c_property_list (plist_cpp, r_count); \
323318 } \
324319 \
325320 static void free_property_list_bind (GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list, uint32_t /* p_count*/ ) { \
326321 if (p_instance) { \
327322 m_class *cls = reinterpret_cast <m_class *>(p_instance); \
328- cls->plist_owned .clear (); \
329323 ::godot::internal::free_c_property_list (const_cast <GDExtensionPropertyInfo *>(p_list)); \
330324 } \
331325 } \
0 commit comments