Skip to content

fix(converter): add thread-safety to static caches#82

Merged
JSv4 merged 1 commit intomainfrom
fix/thread-safe-static-caches
Dec 20, 2025
Merged

fix(converter): add thread-safety to static caches#82
JSv4 merged 1 commit intomainfrom
fix/thread-safe-static-caches

Conversation

@JSv4
Copy link
Copy Markdown
Owner

@JSv4 JSv4 commented Dec 20, 2025

Summary

  • Fixes thread-safety issues with static caches in WmlToHtmlConverter and FontFamilyHelper that could cause corruption during concurrent document conversions
  • Changes ShadeCache to ConcurrentDictionary for thread-safe shade color caching
  • Changes FontFamilyHelper._unknownFonts to ConcurrentDictionary for thread-safe font tracking
  • Uses Lazy<T> for thread-safe lazy initialization of KnownFamilies
  • Adds ClearShadeCache() and ClearUnknownFontsCache() methods for memory management in long-running processes

Test plan

  • Added 3 new concurrent conversion tests that verify thread-safety
  • All existing tests pass (1129 passed, 1 skipped)

Related

Resolves gap #15 in docs/architecture/wml_to_html_converter_gaps.md

- Change ShadeCache in WmlToHtmlConverter to ConcurrentDictionary
- Change _unknownFonts in FontFamilyHelper to ConcurrentDictionary
- Use Lazy<T> for thread-safe lazy initialization of KnownFamilies
- Add ClearShadeCache() and ClearUnknownFontsCache() for memory management
- Add 3 concurrent conversion tests to verify thread-safety
- Update gaps documentation to mark issue #15 as fixed
@JSv4 JSv4 merged commit bef7409 into main Dec 20, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant