bug 424398. fix crash when installing new fonts while loading pages. r=vlad a=beltzner

This commit is contained in:
pavlov@pavlov.net 2008-03-21 14:22:29 -07:00
Родитель 58d0c3b877
Коммит bfb114819b
2 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -79,15 +79,15 @@ class FontEntry
public:
THEBES_INLINE_DECL_REFCOUNTING(FontEntry)
FontEntry(FontFamily *aFontFamily) :
mFamily(aFontFamily), mUnicodeFont(PR_FALSE), mSymbolFont(PR_FALSE),
FontEntry(const nsString& aFaceName) :
mFaceName(aFaceName), mUnicodeFont(PR_FALSE), mSymbolFont(PR_FALSE),
mTrueType(PR_FALSE), mIsType1(PR_FALSE),
mIsBadUnderlineFont(PR_FALSE), mForceGDI(PR_FALSE), mCharset(0), mUnicodeRanges(0)
{
}
FontEntry(const FontEntry& aFontEntry) :
mFamily(aFontEntry.mFamily),
mFaceName(aFontEntry.mFaceName),
mWindowsFamily(aFontEntry.mWindowsFamily),
mWindowsPitch(aFontEntry.mWindowsPitch),
mUnicodeFont(aFontEntry.mUnicodeFont),
@ -104,7 +104,7 @@ public:
}
const nsString& GetName() const {
return mFamily->mName;
return mFaceName;
}
PRBool IsCrappyFont() const {
@ -199,8 +199,7 @@ public:
// whether this font family is in "bad" underline offset blacklist.
PRBool IsBadUnderlineFont() { return mIsBadUnderlineFont != 0; }
/* needs to be a weak pointer to avoid a cycle */
FontFamily *mFamily;
nsString mFaceName;
PRUint8 mWindowsFamily;
PRUint8 mWindowsPitch;

Просмотреть файл

@ -137,7 +137,7 @@ gfxWindowsPlatform::FontEnumProc(const ENUMLOGFONTEXW *lpelfe,
}
}
fe = new FontEntry(ff);
fe = new FontEntry(ff->mName);
/* don't append it until the end in case of error */
fe->mItalic = (logFont.lfItalic == 0xFF);
@ -363,6 +363,9 @@ BuildKeyNameFromFontName(nsAString &aName)
nsresult
gfxWindowsPlatform::UpdateFontList()
{
gfxFontCache *fc = gfxFontCache::GetCache();
if (fc)
fc->AgeAllGenerations();
mFonts.Clear();
mFontAliases.Clear();
mNonExistingFonts.Clear();
@ -693,7 +696,7 @@ gfxWindowsPlatform::FindFontEntry(FontFamily *aFontFamily, const gfxFontStyle *a
for (PRUint32 j = 0; j < 2; j++) {
PRBool matchesSomething = PR_FALSE;
// build up an array of weights that match the italicness we're looking for
for (PRInt32 i = 0; i < aFontFamily->mVariations.Length(); i++) {
for (PRUint32 i = 0; i < aFontFamily->mVariations.Length(); i++) {
nsRefPtr<FontEntry> fe = aFontFamily->mVariations[i];
const PRUint8 weight = (fe->mWeight / 100);
if (fe->mItalic == italic) {