From 736a63b25f5744b245edc31061b4105a5e8465e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herbert=20D=C3=BCrr?= Date: Fri, 15 Jun 2012 08:30:03 +0000 Subject: [PATCH] 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 --- vcl/win/source/gdi/salgdi3.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index a410028ac3d2..3df9f648e8a2 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -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; } // =======================================================================