Skip to content

[web] Clear registered typefaces with the Skwasm font collection - #194216

Draft
yexuan910812 wants to merge 3 commits into
flutter:masterfrom
yexuan910812:fix-skwasm-font-collection-clear
Draft

yexuan910812 wants to merge 3 commits into
flutter:masterfrom
yexuan910812:fix-skwasm-font-collection-clear

Conversation

@yexuan910812

Copy link
Copy Markdown

SkwasmFontCollection.clear() recreates the native collection but retains the old SkwasmTypeface wrappers in registeredTypefaces. Clear that map as well, so repeated font load/clear cycles no longer accumulate those references. Add an isolated regression test that registers two fonts under one family and clears/reloads for three cycles.

Fixes #194215. No public API, website documentation, or flutter/tests migration is needed.

Validation on macOS arm64, Chrome 145, Dart 3.15.0-18.0.dev:

  • New lifecycle test fails on the base revision and passes with the one-line fix.
  • Existing test/ui/font_collection_test.dart: 7 tests pass in chrome-coi-dart2wasm-skwasm-ui.
  • Targeted dart analyze, dart format --set-exit-if-changed, and git diff --check pass.
  • Tests compile the local Dart sources and use the matching official Skwasm artifacts via felt --gcs-prod. Full engine CI has not run locally.

AI-assisted draft, pending contributor review and CLA confirmation before requesting review. This change removes retained references; no GC timing or performance improvement is claimed.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team labels Oct 12, 2026
@google-cla

google-cla Bot commented Oct 12, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web] SkwasmFontCollection.clear retains registered typeface references

1 participant