From c7ff53f5c1137de26e82da1610a0f9f6929b87d4 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 26 Jun 2012 09:38:25 -0700 Subject: [PATCH 1/3] 7145771: [macosx] CreateFont/Register.java test fails because of cached results of getAllFonts() Reviewed-by: igor, flar --- .../classes/sun/awt/CGraphicsEnvironment.java | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/jdk/src/macosx/classes/sun/awt/CGraphicsEnvironment.java b/jdk/src/macosx/classes/sun/awt/CGraphicsEnvironment.java index 15ed911dee7..ab435a93fac 100644 --- a/jdk/src/macosx/classes/sun/awt/CGraphicsEnvironment.java +++ b/jdk/src/macosx/classes/sun/awt/CGraphicsEnvironment.java @@ -200,29 +200,25 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment { return true; } - private Font[] allFontsWithLogical; static String[] sLogicalFonts = { "Serif", "SansSerif", "Monospaced", "Dialog", "DialogInput" }; @Override public Font[] getAllFonts() { - if (allFontsWithLogical == null) + + Font[] newFonts; + Font[] superFonts = super.getAllFonts(); + + int numLogical = sLogicalFonts.length; + int numOtherFonts = superFonts.length; + + newFonts = new Font[numOtherFonts + numLogical]; + System.arraycopy(superFonts,0,newFonts,numLogical,numOtherFonts); + + for (int i = 0; i < numLogical; i++) { - Font[] newFonts; - Font[] superFonts = super.getAllFonts(); - - int numLogical = sLogicalFonts.length; - int numOtherFonts = superFonts.length; - - newFonts = new Font[numOtherFonts + numLogical]; - System.arraycopy(superFonts,0,newFonts,numLogical,numOtherFonts); - - for (int i = 0; i < numLogical; i++) - { - newFonts[i] = new Font(sLogicalFonts[i], Font.PLAIN, 1); - } - allFontsWithLogical = newFonts; + newFonts[i] = new Font(sLogicalFonts[i], Font.PLAIN, 1); } - return java.util.Arrays.copyOf(allFontsWithLogical, allFontsWithLogical.length); + return newFonts; } } From 514f24864dbb9f4d43671c6113e87f65b324ce65 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 26 Jun 2012 09:53:27 -0700 Subject: [PATCH 2/3] 7176447: Lunix/Solaris fontpath.c : double free(family) Reviewed-by: igor, flar --- jdk/src/solaris/native/sun/awt/fontpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/solaris/native/sun/awt/fontpath.c b/jdk/src/solaris/native/sun/awt/fontpath.c index 214ecd0b073..412c6317a1c 100644 --- a/jdk/src/solaris/native/sun/awt/fontpath.c +++ b/jdk/src/solaris/native/sun/awt/fontpath.c @@ -1240,7 +1240,7 @@ Java_sun_font_FontConfigManager_getFontConfig FC_CHARSET, 0, &charset); if (result != FcResultMatch) { free(family); - free(family); + free(fullname); free(styleStr); free(file); (*FcPatternDestroy)(pattern); From 79d14ef96a9875b0df6c632c5c940b82e88b5ed4 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 26 Jun 2012 09:54:29 -0700 Subject: [PATCH 3/3] 7164282: check for NULL return from malloc is testing wrong variable name Reviewed-by: igor, flar --- jdk/src/windows/native/sun/font/lcdglyph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/windows/native/sun/font/lcdglyph.c b/jdk/src/windows/native/sun/font/lcdglyph.c index f909c4de2f2..4f408d17021 100644 --- a/jdk/src/windows/native/sun/font/lcdglyph.c +++ b/jdk/src/windows/native/sun/font/lcdglyph.c @@ -409,7 +409,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows */ imageSize = bytesWidth*height; glyphInfo = (GlyphInfo*)malloc(sizeof(GlyphInfo)+imageSize); - if (malloc == NULL) { + if (glyphInfo == NULL) { FREE_AND_RETURN; } glyphInfo->cellInfo = NULL;