Changeset 236254 in webkit
- Timestamp:
- Sep 20, 2018, 2:00:15 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/FontCache.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r236247 r236254 1 2018-09-20 Simon Fraser <simon.fraser@apple.com> 2 3 Fix crash under FontCache::purgeInactiveFontData() when a memory warning fires 4 https://bugs.webkit.org/show_bug.cgi?id=189722 5 rdar://problem/44182860 6 7 Reviewed by Myles C. Maxfield. 8 9 Hashing of FontPlatformData for cachedFonts() is somewhat broken because CFEqual() on CTFont 10 can return false when the fonts are actually the same, and have the same CFHash(). This 11 can result in multiple entries in cachedFonts() with the same Font. 12 13 Then in FontCache::purgeInactiveFontData(), the loop that appends fonts to fontsToDelete 14 gets the value by reference, and WTFMoves it into fontsToDelete. This nulls out all 15 the entries sharing the same value, leaving null entries in the hash table. 16 We later crash at font->hasOneRef() when using one of those null entries. 17 18 Fix by making a copy of the RefPtr<Font> in the loop, so the WTFMove doesn't nuke 19 the hash table entries. The entries will get removed at cachedFonts().remove() lower down. 20 21 * platform/graphics/FontCache.cpp: 22 (WebCore::FontCache::purgeInactiveFontData): 23 1 24 2018-09-20 Antoine Quint <graouts@apple.com> 2 25 -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r235862 r236254 377 377 while (purgeCount) { 378 378 Vector<RefPtr<Font>, 20> fontsToDelete; 379 for (auto &font : cachedFonts().values()) {379 for (auto font : cachedFonts().values()) { 380 380 LOG(Fonts, " trying to purge font %s (has one ref %d)", font->platformData().description().utf8().data(), font->hasOneRef()); 381 381 if (!font->hasOneRef())
Note:
See TracChangeset
for help on using the changeset viewer.