-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix mutating Paint bug #171180
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
Fix mutating Paint bug #171180
Conversation
| /// | ||
| /// This matcher does not work well when [Paint] instances are mutated and | ||
| /// reused. Create a new instance of [Paint] for subsequent draw calls instead | ||
| /// of mutating and reusing one instance. |
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.
reusing the paint is fine, but it is just our TestRecordingCanvas can't handle it. I think we should fix the TestRecordingCanvas instead.
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.
Good point, that should be doable. I'll take a look.
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
This only fixes it for drawCircle. I'll have to implement all the other canvas calls.
|
This will require adding similar changes for all of the other methods in Canvas. Moving to draft for now. |
|
This is ready for re-review. Now it solves the problem for every Canvas method that uses Paint. |
flutter/flutter@9c626d9...440713c 2025-07-18 [email protected] Add OS version support section to plugin docs (flutter/flutter#172316) 2025-07-18 [email protected] Roll Dart SDK from 7fcc5f48c335 to fe2232bd5b9f (2 revisions) (flutter/flutter#172339) 2025-07-18 [email protected] Refactor handling of frame waiting. (flutter/flutter#172277) 2025-07-18 [email protected] Roll pub packages (flutter/flutter#172332) 2025-07-17 [email protected] Refactor and forbid `base/exit.dart` outside of `lib/runner.dart` (flutter/flutter#171923) 2025-07-17 [email protected] Use UTC timezone for `stamp_command_test` to avoid local TZ flakes (flutter/flutter#172319) 2025-07-17 [email protected] [web] Add tests for unified platform view embedding behavior (flutter/flutter#172313) 2025-07-17 [email protected] Platform views shouldn't receive pointer events when not laid out (flutter/flutter#172043) 2025-07-17 [email protected] Fix Size.isEmpty description (flutter/flutter#172021) 2025-07-17 [email protected] feat: Add `maxCount` parameter to `Badge.count` constructor. (flutter/flutter#171054) 2025-07-17 [email protected] add `debugPaintTextLayoutBoxes` for debugging text layout (flutter/flutter#168876) 2025-07-17 [email protected] Roll Packages from 4a231ae to cb8fef6 (31 revisions) (flutter/flutter#172303) 2025-07-17 [email protected] Fix mutating Paint bug (flutter/flutter#171180) 2025-07-17 [email protected] No SystemContextMenu when readOnly is true (flutter/flutter#171242) 2025-07-17 [email protected] Add a getter to get the recorder used by painting context (flutter/flutter#170223) 2025-07-17 [email protected] [Impeller] Add missing SetPipeline call for the vertices uber pipeline in AtlasContents (flutter/flutter#172273) 2025-07-17 [email protected] Roll Dart SDK from 486f9c0663bc to 7fcc5f48c335 (1 revision) (flutter/flutter#172279) 2025-07-17 [email protected] Roll Skia from 3673a1f26a63 to 9587301e33bc (3 revisions) (flutter/flutter#172281) 2025-07-17 [email protected] Fix a race in FlutterEngineTest.CanLogToStdout (flutter/flutter#172025) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
A tricky bug was encountered in https://github.com/flutter/flutter/pull/170321/files#r2138619243 where mutating Paint caused [paints](https://main-api.flutter.dev/flutter/flutter_test/paints.html) to behave strangely. Originally this PR just added something to the docs for `paints` to give people a heads up, but now it fixes the root cause. Yak shave 🪒 . Fixes flutter#171194
…r#9646) flutter/flutter@9c626d9...440713c 2025-07-18 [email protected] Add OS version support section to plugin docs (flutter/flutter#172316) 2025-07-18 [email protected] Roll Dart SDK from 7fcc5f48c335 to fe2232bd5b9f (2 revisions) (flutter/flutter#172339) 2025-07-18 [email protected] Refactor handling of frame waiting. (flutter/flutter#172277) 2025-07-18 [email protected] Roll pub packages (flutter/flutter#172332) 2025-07-17 [email protected] Refactor and forbid `base/exit.dart` outside of `lib/runner.dart` (flutter/flutter#171923) 2025-07-17 [email protected] Use UTC timezone for `stamp_command_test` to avoid local TZ flakes (flutter/flutter#172319) 2025-07-17 [email protected] [web] Add tests for unified platform view embedding behavior (flutter/flutter#172313) 2025-07-17 [email protected] Platform views shouldn't receive pointer events when not laid out (flutter/flutter#172043) 2025-07-17 [email protected] Fix Size.isEmpty description (flutter/flutter#172021) 2025-07-17 [email protected] feat: Add `maxCount` parameter to `Badge.count` constructor. (flutter/flutter#171054) 2025-07-17 [email protected] add `debugPaintTextLayoutBoxes` for debugging text layout (flutter/flutter#168876) 2025-07-17 [email protected] Roll Packages from 4a231ae to cb8fef6 (31 revisions) (flutter/flutter#172303) 2025-07-17 [email protected] Fix mutating Paint bug (flutter/flutter#171180) 2025-07-17 [email protected] No SystemContextMenu when readOnly is true (flutter/flutter#171242) 2025-07-17 [email protected] Add a getter to get the recorder used by painting context (flutter/flutter#170223) 2025-07-17 [email protected] [Impeller] Add missing SetPipeline call for the vertices uber pipeline in AtlasContents (flutter/flutter#172273) 2025-07-17 [email protected] Roll Dart SDK from 486f9c0663bc to 7fcc5f48c335 (1 revision) (flutter/flutter#172279) 2025-07-17 [email protected] Roll Skia from 3673a1f26a63 to 9587301e33bc (3 revisions) (flutter/flutter#172281) 2025-07-17 [email protected] Fix a race in FlutterEngineTest.CanLogToStdout (flutter/flutter#172025) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
A tricky bug was encountered in https://github.com/flutter/flutter/pull/170321/files#r2138619243 where mutating Paint caused [paints](https://main-api.flutter.dev/flutter/flutter_test/paints.html) to behave strangely. Originally this PR just added something to the docs for `paints` to give people a heads up, but now it fixes the root cause. Yak shave 🪒 . Fixes flutter#171194
A tricky bug was encountered in https://github.com/flutter/flutter/pull/170321/files#r2138619243 where mutating Paint caused [paints](https://main-api.flutter.dev/flutter/flutter_test/paints.html) to behave strangely. Originally this PR just added something to the docs for `paints` to give people a heads up, but now it fixes the root cause. Yak shave 🪒 . Fixes flutter#171194
A tricky bug was encountered in https://github.com/flutter/flutter/pull/170321/files#r2138619243 where mutating Paint caused [paints](https://main-api.flutter.dev/flutter/flutter_test/paints.html) to behave strangely. Originally this PR just added something to the docs for `paints` to give people a heads up, but now it fixes the root cause. Yak shave 🪒 . Fixes flutter#171194
A tricky bug was encountered in https://github.com/flutter/flutter/pull/170321/files#r2138619243 where mutating Paint caused paints to behave strangely.
Originally this PR just added something to the docs for
paintsto give people a heads up, but now it fixes the root cause. Yak shave 🪒 .Fixes #171194