Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 48d994887c9456fe1f7ea44a6d0859fa07eb266b
      
https://github.com/WebKit/WebKit/commit/48d994887c9456fe1f7ea44a6d0859fa07eb266b
  Author: Richard Robinson <[email protected]>
  Date:   2024-11-13 (Wed, 13 Nov 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/Font.cpp
    M Source/WebCore/platform/graphics/SystemFallbackFontCache.cpp
    M Source/WebCore/platform/graphics/SystemFallbackFontCache.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm

  Log Message:
  -----------
  [Writing Tools] Outlook.app quits unexpectedly with Writing Tools
https://bugs.webkit.org/show_bug.cgi?id=283098
rdar://139513909

Reviewed by Wenson Hsieh and Abrar Rahman Protyasha.

The `SystemFallbackFontCache` system depends on using a `WebCore::Timer`. In 
the destructor of `Font`,
a font cache is accessed and the font is removed from the cache. Notably, even 
if there is no cache,
one is erroneously created anyways.

The `AttributedString` type uses the `Font` type and therefore indirectly uses 
a `WebCore::Timer`.
Therefore, any use of `AttributedString` in the UI process is unsafe, as it is 
not allowed to use a
`WebCore::Timer` in the UI process.

This issue manifests in the implementation of Writing Tools, which uses 
AttributedStrings in the UI
process. This issue was always present, however it turned into a crash once a 
release assert was a
dded in `WebCore::Timer`.

To fix this, ensure that a new font cache is not created in the destructor of 
Font.

* Source/WebCore/platform/graphics/Font.cpp:
(WebCore::Font::~Font):
* Source/WebCore/platform/graphics/SystemFallbackFontCache.cpp:
(WebCore::SystemFallbackFontCache::forCurrentThreadIfExists):
* Source/WebCore/platform/graphics/SystemFallbackFontCache.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(TEST(WritingTools, AttributedStringWithWebKitLegacy)):

Canonical link: https://commits.webkit.org/286579@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to