Resolves: #i119997# fix a memory leak by WinGlyphFallbackSubstitution

Patch by: Chao Huang
Found by: Chao Huang
Review by: hdu

Conflicts:
	vcl/win/source/gdi/salgdi3.cxx

Change-Id: I6cde84b54a42fd8951d68280fac9dccd2b2e5c4a
This commit is contained in:
Herbert Dürr 2012-06-15 08:30:03 +00:00 committed by Caolán McNamara
parent 2c85769d94
commit 736a63b25f

View file

@ -589,23 +589,27 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon
}
// last level fallback, check each font type face one by one
const ImplGetDevFontList* pTestFontList = pDevFontList->GetDevFontList();
ImplGetDevFontList* pTestFontList = pDevFontList->GetDevFontList();
// limit the count of fonts to be checked to prevent hangs
static const int MAX_GFBFONT_COUNT = 600;
int nTestFontCount = pTestFontList->Count();
if( nTestFontCount > MAX_GFBFONT_COUNT )
nTestFontCount = MAX_GFBFONT_COUNT;
bool bFound = false;
for( int i = 0; i < nTestFontCount; ++i )
{
const PhysicalFontFace* pFace = pTestFontList->Get( i );
if( !HasMissingChars( pFace, rMissingChars ) )
bFound = HasMissingChars( pFace, rMissingChars );
if( !bFound )
continue;
rFontSelData.maSearchName = pFace->GetFamilyName();
return true;
break;
}
return false;
delete pTestFontList;
return bFound;
}
// =======================================================================