This repository was archived by the owner on Feb 25, 2025. It is now read-only.
[macOS] Fix engine/binaryMessenger retain cycle#44471
Merged
cbracken merged 1 commit intoflutter:mainfrom Aug 8, 2023
cbracken:macos-use-binarymessengerrelay
Merged
[macOS] Fix engine/binaryMessenger retain cycle#44471cbracken merged 1 commit intoflutter:mainfrom cbracken:macos-use-binarymessengerrelay
cbracken merged 1 commit intoflutter:mainfrom
cbracken:macos-use-binarymessengerrelay
Conversation
Previously, FlutterEngine.binaryMessenger returned the FlutterEngine instance itself, which meant that channels/plugins could hold a strong reference to the engine and thus cause a retain cycle, preventing the engine from being deallocated. We introduce FlutterBinaryMessengerRelay, which implements the FlutterBinaryMessenger protocol, by delegating back to the engine, to which it holds a weak reference, thus avoiding the retain cycle. This also changes the FlutterBinaryMessengerRelay.parent property from an assign property to a weak property since that code is compiled with ARC enabled as of #44395. This patch also rearranges the headers to comply with our style guide: related headers for this file, C headers, C++ headers, other Flutter headers, in that order. Issue: flutter/flutter#116445
Contributor
|
auto label is removed for flutter/engine/44471, due to - The status or check suite Linux linux_clang_tidy has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Contributor
|
auto label is removed for flutter/engine/44471, due to - The status or check suite Linux linux_clang_tidy has failed. Please fix the issues identified (or deflake) before re-applying this label. |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Aug 8, 2023
auto-submit bot
pushed a commit
to flutter/flutter
that referenced
this pull request
Aug 8, 2023
flutter/engine@99fdac8...22bd35a 2023-08-08 chris@bracken.jp [macOS] Fix engine/binaryMessenger retain cycle (flutter/engine#44471) 2023-08-08 skia-flutter-autoroll@skia.org Roll Skia from f7162d33afb2 to 66ba512c613c (8 revisions) (flutter/engine#44497) 2023-08-08 mdebbar@google.com [web] Expose the benchmark callback through dart:ui_web (flutter/engine#44461) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
14 tasks
gaaclarke
pushed a commit
to gaaclarke/engine
that referenced
this pull request
Aug 30, 2023
Previously, FlutterEngine.binaryMessenger returned the FlutterEngine instance itself, which meant that channels/plugins could hold a strong reference to the engine and thus cause a retain cycle, preventing the engine from being deallocated. We introduce FlutterBinaryMessengerRelay, which implements the FlutterBinaryMessenger protocol, by delegating back to the engine, to which it holds a weak reference, thus avoiding the retain cycle. This also changes the FlutterBinaryMessengerRelay.parent property from an assign property to a weak property since that code is compiled with ARC enabled as of flutter#44395. This patch also rearranges the headers to comply with our style guide: related headers for this file, C headers, C++ headers, other Flutter headers, in that order. Fixes: flutter/flutter#116445
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Previously, FlutterEngine.binaryMessenger returned the FlutterEngine instance itself, which meant that channels/plugins could hold a strong reference to the engine and thus cause a retain cycle, preventing the engine from being deallocated.
We introduce FlutterBinaryMessengerRelay, which implements the FlutterBinaryMessenger protocol, by delegating back to the engine, to which it holds a weak reference, thus avoiding the retain cycle.
This also changes the FlutterBinaryMessengerRelay.parent property from an assign property to a weak property since that code is compiled with ARC enabled as of #44395.
This patch also rearranges the headers to comply with our style guide: related headers for this file, C headers, C++ headers, other Flutter headers, in that order.
Fixes: flutter/flutter#116445
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.