Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Crash under FontCache::purgeInactiveFontData()
https://bugs.webkit.org/show_bug.cgi?id=156822 <rdar://problem/25373970> Reviewed by Darin Adler. In some rare cases, the Font constructor would mutate the FontPlatformData that is being passed in. This is an issue because because our FontCache uses the FontPlatformData as key for the cached fonts. This could lead to crashes because the WTFMove() in FontCache::purgeInactiveFontData() would nullify values in our HashMap but we would then fail to remove them from the HashMap (because the key did not match). We would then reference the null font when looping again when doing font->hasOneRef(). This patch marks Font::m_platformData member as const to avoid such issues in the future and moves the code altering the FontPlatformData from the Font constructor into the FontPlatformData constructor. The purpose of that code was to initialize FontPlatformData::m_cgFont in case the CGFont passed in the constructor was null. * platform/graphics/Font.h: * platform/graphics/FontCache.cpp: (WebCore::FontCache::fontForPlatformData): (WebCore::FontCache::purgeInactiveFontData): * platform/graphics/FontPlatformData.cpp: (WebCore::FontPlatformData::FontPlatformData): * platform/graphics/FontPlatformData.h: * platform/graphics/cocoa/FontCocoa.mm: (WebCore::webFallbackFontFamily): Deleted. (WebCore::Font::platformInit): Deleted. * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::webFallbackFontFamily): (WebCore::FontPlatformData::setFallbackCGFont): * platform/graphics/win/FontPlatformDataCGWin.cpp: (WebCore::FontPlatformData::setFallbackCGFont): Canonical link: https://commits.webkit.org/175019@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
133 additions
and 73 deletions.
- +38 −0 Source/WebCore/ChangeLog
- +1 −1 Source/WebCore/platform/graphics/Font.h
- +6 −2 Source/WebCore/platform/graphics/FontCache.cpp
- +2 −0 Source/WebCore/platform/graphics/FontPlatformData.cpp
- +3 −0 Source/WebCore/platform/graphics/FontPlatformData.h
- +1 −60 Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
- +71 −0 Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
- +1 −1 Source/WebCore/platform/graphics/freetype/FontPlatformData.h
- +1 −1 Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
- +6 −0 Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
- +3 −0 Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp
- +0 −1 Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp
- +0 −7 Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -273,7 +273,7 @@ HarfBuzzFace* FontPlatformData::harfBuzzFace() const | ||
return m_harfBuzzFace.get(); | ||
} | ||
|
||
bool FontPlatformData::isFixedPitch() const | ||
{ | ||
return m_fixedWidth; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters