-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Reland: Move asset opening to background thread, fix dart persistent value destruction #40183
Conversation
…ne into move_decompress_to_io
if (!dart_state) { | ||
return; | ||
} | ||
tonic::DartState::Scope scope(dart_state); | ||
|
||
std::unique_ptr<tonic::DartPersistentValue> buffer_handle( |
There was a problem hiding this comment.
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_ptr
s should be moved to the top of the function in order to ensure that they are not leaked if it returns early.
…ersistent value destruction (flutter/engine#40183)
…ersistent value destruction (flutter/engine#40183)
Reland of #39918 but with the fixes suggested by @jason-simmons from #40147