зеркало из https://github.com/mozilla/pjs.git
Fix for bugs 4800 and 4810. I forgot to free a font handle, which led to
system resource exhaustion and machine shutdown (on Win95).
This commit is contained in:
Родитель
f55899f2c6
Коммит
3f10e7bfd4
|
@ -992,13 +992,13 @@ PRUint8 bitToCharSet[64] =
|
||||||
/*13*/ DEFAULT_CHARSET,
|
/*13*/ DEFAULT_CHARSET,
|
||||||
/*14*/ DEFAULT_CHARSET,
|
/*14*/ DEFAULT_CHARSET,
|
||||||
/*15*/ DEFAULT_CHARSET,
|
/*15*/ DEFAULT_CHARSET,
|
||||||
/*16*/ DEFAULT_CHARSET,
|
/*16*/ THAI_CHARSET,
|
||||||
/*17*/ THAI_CHARSET,
|
/*17*/ SHIFTJIS_CHARSET,
|
||||||
/*18*/ SHIFTJIS_CHARSET,
|
/*18*/ GB2312_CHARSET,
|
||||||
/*19*/ GB2312_CHARSET,
|
/*19*/ HANGEUL_CHARSET,
|
||||||
/*20*/ HANGEUL_CHARSET,
|
/*20*/ CHINESEBIG5_CHARSET,
|
||||||
/*21*/ CHINESEBIG5_CHARSET,
|
/*21*/ JOHAB_CHARSET,
|
||||||
/*22*/ JOHAB_CHARSET,
|
/*22*/ DEFAULT_CHARSET,
|
||||||
/*23*/ DEFAULT_CHARSET,
|
/*23*/ DEFAULT_CHARSET,
|
||||||
/*24*/ DEFAULT_CHARSET,
|
/*24*/ DEFAULT_CHARSET,
|
||||||
/*25*/ DEFAULT_CHARSET,
|
/*25*/ DEFAULT_CHARSET,
|
||||||
|
@ -1391,7 +1391,7 @@ static nsCharSetInfo gCharSetInfo[eCharSet_COUNT] =
|
||||||
{ "GB2312", 936, GenerateMultiByte },
|
{ "GB2312", 936, GenerateMultiByte },
|
||||||
{ "HANGEUL", 949, GenerateMultiByte },
|
{ "HANGEUL", 949, GenerateMultiByte },
|
||||||
{ "CHINESEBIG5", 950, GenerateMultiByte },
|
{ "CHINESEBIG5", 950, GenerateMultiByte },
|
||||||
{ "JOHAB", 0, GenerateMultiByte }
|
{ "JOHAB", 1361, GenerateMultiByte }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1404,6 +1404,13 @@ HaveConverterFor(PRUint8 aCharSet)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove from table, since we can't support it anyway
|
||||||
|
for (int i = 0; i < sizeof(bitToCharSet); i++) {
|
||||||
|
if (bitToCharSet[i] == aCharSet) {
|
||||||
|
bitToCharSet[i] = DEFAULT_CHARSET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1418,16 +1425,21 @@ nsFontWinA::GetSubsets(HDC aDC)
|
||||||
int dword;
|
int dword;
|
||||||
DWORD* array = signature.fsCsb;
|
DWORD* array = signature.fsCsb;
|
||||||
mSubsetsCount = 0;
|
mSubsetsCount = 0;
|
||||||
|
int i = 0;
|
||||||
for (dword = 0; dword < 2; dword++) {
|
for (dword = 0; dword < 2; dword++) {
|
||||||
for (int bit = 0; bit < sizeof(DWORD) * 8; bit++) {
|
for (int bit = 0; bit < sizeof(DWORD) * 8; bit++) {
|
||||||
if ((array[dword] >> bit) & 1) {
|
if ((array[dword] >> bit) & 1) {
|
||||||
PRUint8 charSet = bitToCharSet[bit];
|
PRUint8 charSet = bitToCharSet[i];
|
||||||
|
#ifdef DEBUG_FONT_SIGNATURE
|
||||||
|
printf(" %02d %s\n", i, gCharSetInfo[gCharSetToIndex[charSet]].mName);
|
||||||
|
#endif
|
||||||
if (charSet != DEFAULT_CHARSET) {
|
if (charSet != DEFAULT_CHARSET) {
|
||||||
if (HaveConverterFor(charSet)) {
|
if (HaveConverterFor(charSet)) {
|
||||||
mSubsetsCount++;
|
mSubsetsCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1437,18 +1449,20 @@ nsFontWinA::GetSubsets(HDC aDC)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
i = 0;
|
||||||
|
int j = 0;
|
||||||
for (dword = 0; dword < 2; dword++) {
|
for (dword = 0; dword < 2; dword++) {
|
||||||
for (int bit = 0; bit < sizeof(DWORD) * 8; bit++) {
|
for (int bit = 0; bit < sizeof(DWORD) * 8; bit++) {
|
||||||
if ((array[dword] >> bit) & 1) {
|
if ((array[dword] >> bit) & 1) {
|
||||||
PRUint8 charSet = bitToCharSet[bit];
|
PRUint8 charSet = bitToCharSet[i];
|
||||||
if (charSet != DEFAULT_CHARSET) {
|
if (charSet != DEFAULT_CHARSET) {
|
||||||
if (HaveConverterFor(charSet)) {
|
if (HaveConverterFor(charSet)) {
|
||||||
mSubsets[i].mCharSet = charSet;
|
mSubsets[j].mCharSet = charSet;
|
||||||
i++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1470,6 +1484,9 @@ FreeFont(nsFontWinA* aFont)
|
||||||
subset++;
|
subset++;
|
||||||
}
|
}
|
||||||
PR_Free(aFont->mSubsets);
|
PR_Free(aFont->mSubsets);
|
||||||
|
if (aFont->mFont) {
|
||||||
|
::DeleteObject(aFont->mFont);
|
||||||
|
}
|
||||||
delete aFont;
|
delete aFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1535,6 +1552,9 @@ nsFontMetricsWinA::LoadFont(HDC aDC, nsString* aName)
|
||||||
HFONT oldFont = (HFONT) ::SelectObject(aDC, (HGDIOBJ) hfont);
|
HFONT oldFont = (HFONT) ::SelectObject(aDC, (HGDIOBJ) hfont);
|
||||||
font->mFont = hfont;
|
font->mFont = hfont;
|
||||||
font->mLogFont = logFont;
|
font->mLogFont = logFont;
|
||||||
|
#ifdef DEBUG_FONT_SIGNATURE
|
||||||
|
printf("%s\n", logFont.lfFaceName);
|
||||||
|
#endif
|
||||||
if (!font->GetSubsets(aDC)) {
|
if (!font->GetSubsets(aDC)) {
|
||||||
mLoadedFontsCount--;
|
mLoadedFontsCount--;
|
||||||
::SelectObject(aDC, (HGDIOBJ) oldFont);
|
::SelectObject(aDC, (HGDIOBJ) oldFont);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче