Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store arrays inside of Variant as shared. #36492

Merged
merged 1 commit into from
Feb 23, 2020

Conversation

reduz
Copy link
Member

@reduz reduz commented Feb 23, 2020

Arrays inside of Variant are unique and use reference counting.
When you assign a variant containing a packed array to another, or
when you call non const functions to arrays, this will work even
if the array is inside a dictionary, so they will from now pass
as reference.

The difference with regular variant arrays is that, once passed
to a function in the C++ API, they are no longer shared. This is
required for security and thread safety, as those arrays are
mainly used to pass data back and forth even between threads.

@akien-mga akien-mga added this to the 4.0 milestone Feb 23, 2020
@reduz reduz force-pushed the variant-vector-refcounted branch from 0fd6ff0 to 83ad232 Compare February 23, 2020 21:20
Arrays inside of Variant are unique and use reference counting.
When you assign a variant containing a packed array to another, or
when you call non const functions to arrays, this will work even
if the array is inside a dictionary, so they will from now pass
as reference.

The difference with regular variant arrays is that, once passed
to a function in the C++ API, they are no longer shared. This is
required for security and thread safety, as those arrays are
mainly used to pass data back and forth even between threads.
@akien-mga akien-mga force-pushed the variant-vector-refcounted branch from 83ad232 to 88f84c7 Compare February 23, 2020 21:42
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

OK to merge when CI passes.

@akien-mga akien-mga merged commit 4b6c056 into godotengine:master Feb 23, 2020
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants