Changeset 236509 in webkit
- Timestamp:
- Sep 26, 2018, 11:20:06 AM (8 years ago)
- Location:
- tags/Safari-607.1.7.3/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/FontCache.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tags/Safari-607.1.7.3/Source/WebCore/ChangeLog
r236268 r236509 1 2018-09-26 Babak Shafiei <bshafiei@apple.com> 2 3 Cherry-pick r236254. rdar://problem/44182860 4 5 Fix crash under FontCache::purgeInactiveFontData() when a memory warning fires 6 https://bugs.webkit.org/show_bug.cgi?id=189722 7 rdar://problem/44182860 8 9 Reviewed by Myles C. Maxfield. 10 11 Hashing of FontPlatformData for cachedFonts() is somewhat broken because CFEqual() on CTFont 12 can return false when the fonts are actually the same, and have the same CFHash(). This 13 can result in multiple entries in cachedFonts() with the same Font. 14 15 Then in FontCache::purgeInactiveFontData(), the loop that appends fonts to fontsToDelete 16 gets the value by reference, and WTFMoves it into fontsToDelete. This nulls out all 17 the entries sharing the same value, leaving null entries in the hash table. 18 We later crash at font->hasOneRef() when using one of those null entries. 19 20 Fix by making a copy of the RefPtr<Font> in the loop, so the WTFMove doesn't nuke 21 the hash table entries. The entries will get removed at cachedFonts().remove() lower down. 22 23 * platform/graphics/FontCache.cpp: 24 (WebCore::FontCache::purgeInactiveFontData): 25 26 27 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236254 268f45cc-cd09-0410-ab3c-d52691b4dbfc 28 29 2018-09-20 Simon Fraser <simon.fraser@apple.com> 30 31 Fix crash under FontCache::purgeInactiveFontData() when a memory warning fires 32 https://bugs.webkit.org/show_bug.cgi?id=189722 33 rdar://problem/44182860 34 35 Reviewed by Myles C. Maxfield. 36 37 Hashing of FontPlatformData for cachedFonts() is somewhat broken because CFEqual() on CTFont 38 can return false when the fonts are actually the same, and have the same CFHash(). This 39 can result in multiple entries in cachedFonts() with the same Font. 40 41 Then in FontCache::purgeInactiveFontData(), the loop that appends fonts to fontsToDelete 42 gets the value by reference, and WTFMoves it into fontsToDelete. This nulls out all 43 the entries sharing the same value, leaving null entries in the hash table. 44 We later crash at font->hasOneRef() when using one of those null entries. 45 46 Fix by making a copy of the RefPtr<Font> in the loop, so the WTFMove doesn't nuke 47 the hash table entries. The entries will get removed at cachedFonts().remove() lower down. 48 49 * platform/graphics/FontCache.cpp: 50 (WebCore::FontCache::purgeInactiveFontData): 51 1 52 2018-09-20 Kocsen Chung <kocsen_chung@apple.com> 2 53 -
tags/Safari-607.1.7.3/Source/WebCore/platform/graphics/FontCache.cpp
r235862 r236509 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.