This repository was archived by the owner on Feb 25, 2025. It is now read-only.
During image decoding, avoid using smart pointers for DartWrappables that cross thread-boundaries. #23503
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #19843, a regression was introduced
where an image descriptor object that has a Dart peer could be collected on a
concurrent task runner thread. Collection of such object needs to enter isolate
scope which might still be active on the UI thread. A comment in the original
commit explicitly mentions this and attempts to achieve the collection of the
Dart wrappable on the UI task runner. However, the author missed that the object
was present in the captures of a copyable closure. These captures may be
released on any of the participating threads. To avoid the the indeterminism of
the smart pointer being dropped on the concurrent task runner thread, this patch
resorts to manually reference counting the descriptor.
Fixes flutter/flutter#72144