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

Reland: Move asset opening to background thread, fix dart persistent value destruction #40183

Merged
merged 14 commits into from
Mar 9, 2023

Conversation

jonahwilliams
Copy link
Member

Reland of #39918 but with the fixes suggested by @jason-simmons from #40147

@chinmaygarde chinmaygarde self-requested a review March 9, 2023 21:17
if (!dart_state) {
return;
}
tonic::DartState::Scope scope(dart_state);

std::unique_ptr<tonic::DartPersistentValue> buffer_handle(
Copy link
Member

Choose a reason for hiding this comment

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

Looked into this, and it's actually ok to destruct the tonic::DartPersistentValue outside of a DartState::Scope. The DartPersistentValue holds a weak reference to the DartState used during construction and will enter that DartState's scope to delete the wrapped value.

So these unique_ptrs should be moved to the top of the function in order to ensure that they are not leaked if it returns early.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants