Skip to content

Conversation

@dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Jan 19, 2026

In order to work around an issue where we need to keep the List<PropertyInfo> for _get_property_list() alive until the data it contains isn't needed anymore, we've been reusing the same List<PropertyInfo>.

This works fine in a single-threaded scenario, but when multiple threads are involved, they'll stomp all over the list at the same time.

This PR makes it so that we aren't reusing the same List<PropertyInfo>, but instead, allocating a new one each time.

The tricky part is that we need to hang onto a pointer to it, so that we can free it when we're done. However, Godot will only pass us the GDExtensionPropertyInfo * and doesn't let us stash any extra data. So, this PR uses the padding that's added by Memory::alloc_static() to stash the pointer in the same place that we usually put the element count when doing memnew_arr().

This is a little hacky, and it would be better if Godot gave us a place to stash some extra data instead, but this does seem to work in my testing :-)

Fixes godotengine/godot#115017

@dsnopek dsnopek added this to the 10.x milestone Jan 19, 2026
@dsnopek dsnopek requested a review from a team as a code owner January 19, 2026 23:01
@dsnopek dsnopek added bug This has been identified as a bug crash labels Jan 19, 2026
Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue, code looks good.

@akien-mga akien-mga merged commit 890c10d into godotengine:master Jan 20, 2026
19 checks passed
@akien-mga
Copy link
Member

Thanks!

@dsnopek dsnopek mentioned this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This has been identified as a bug crash

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal error, property list was not freed by engine! (Regression crash)

3 participants