Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ad6fa056
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ad6fa056
编写于
1月 12, 2011
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6958221: java.awt.Font.getFamily() leads to JVM crash on Linux on JDK7 for "custom" fonts
Reviewed-by: igor, jgodinez
上级
a08aabd6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
58 addition
and
100 deletion
+58
-100
make/sun/awt/mapfile-mawt-vers
make/sun/awt/mapfile-mawt-vers
+1
-2
make/sun/awt/mapfile-vers-linux
make/sun/awt/mapfile-vers-linux
+1
-2
make/sun/headless/mapfile-vers
make/sun/headless/mapfile-vers
+0
-1
make/sun/xawt/mapfile-vers
make/sun/xawt/mapfile-vers
+1
-2
src/solaris/classes/sun/awt/X11FontManager.java
src/solaris/classes/sun/awt/X11FontManager.java
+6
-20
src/solaris/classes/sun/awt/motif/MToolkit.java
src/solaris/classes/sun/awt/motif/MToolkit.java
+0
-7
src/solaris/native/sun/awt/fontpath.c
src/solaris/native/sun/awt/fontpath.c
+8
-66
test/java/awt/FontClass/X11FontPathCrashTest.java
test/java/awt/FontClass/X11FontPathCrashTest.java
+41
-0
未找到文件。
make/sun/awt/mapfile-mawt-vers
浏览文件 @
ad6fa056
...
@@ -515,8 +515,7 @@ SUNWprivate_1.1 {
...
@@ -515,8 +515,7 @@ SUNWprivate_1.1 {
getDefaultConfig;
getDefaultConfig;
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_awt_X11FontManager_getFontPath;
Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_awt_X11FontManager_setNativeFontPath;
Java_sun_font_SunFontManager_populateFontFileNameMap;
Java_sun_font_SunFontManager_populateFontFileNameMap;
# CDE private entry point
# CDE private entry point
...
...
make/sun/awt/mapfile-vers-linux
浏览文件 @
ad6fa056
...
@@ -537,8 +537,7 @@ SUNWprivate_1.1 {
...
@@ -537,8 +537,7 @@ SUNWprivate_1.1 {
getDefaultConfig;
getDefaultConfig;
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_awt_X11FontManager_getFontPath;
Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_awt_X11FontManager_setNativeFontPath;
Java_sun_font_SunFontManager_populateFontFileNameMap;
Java_sun_font_SunFontManager_populateFontFileNameMap;
# CDE private entry point
# CDE private entry point
...
...
make/sun/headless/mapfile-vers
浏览文件 @
ad6fa056
...
@@ -65,7 +65,6 @@ SUNWprivate_1.1 {
...
@@ -65,7 +65,6 @@ SUNWprivate_1.1 {
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigVersion;
Java_sun_font_FontConfigManager_getFontConfigVersion;
Java_sun_awt_X11FontManager_getFontPath;
Java_sun_awt_FontDescriptor_initIDs;
Java_sun_awt_FontDescriptor_initIDs;
Java_sun_awt_PlatformFont_initIDs;
Java_sun_awt_PlatformFont_initIDs;
...
...
make/sun/xawt/mapfile-vers
浏览文件 @
ad6fa056
...
@@ -188,8 +188,7 @@ SUNWprivate_1.1 {
...
@@ -188,8 +188,7 @@ SUNWprivate_1.1 {
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigVersion;
Java_sun_font_FontConfigManager_getFontConfigVersion;
Java_sun_awt_X11FontManager_getFontPath;
Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_font_X11FontManager_setNativeFontPath;
Java_sun_awt_X11GraphicsEnvironment_initDisplay;
Java_sun_awt_X11GraphicsEnvironment_initDisplay;
Java_sun_awt_X11GraphicsEnvironment_initGLX;
Java_sun_awt_X11GraphicsEnvironment_initGLX;
Java_sun_awt_X11GraphicsEnvironment_initXRender;
Java_sun_awt_X11GraphicsEnvironment_initXRender;
...
...
src/solaris/classes/sun/awt/X11FontManager.java
浏览文件 @
ad6fa056
...
@@ -718,25 +718,6 @@ public class X11FontManager extends SunFontManager {
...
@@ -718,25 +718,6 @@ public class X11FontManager extends SunFontManager {
fontdirs
=
(
String
[])
fontConfigDirs
.
toArray
(
new
String
[
0
]);
fontdirs
=
(
String
[])
fontConfigDirs
.
toArray
(
new
String
[
0
]);
}
}
/* Called by MToolkit to set the X11 font path */
public
static
void
setNativeFontPath
()
{
if
(
fontdirs
==
null
)
{
return
;
}
// need to register these individually rather than by one call
// to ensure that one bad directory doesn't cause all to be rejected
for
(
int
i
=
0
;
i
<
fontdirs
.
length
;
i
++)
{
if
(
FontUtilities
.
debugFonts
())
{
FontUtilities
.
getLogger
().
info
(
"Add "
+
fontdirs
[
i
]
+
" to X11 fontpath"
);
}
setNativeFontPath
(
fontdirs
[
i
]);
}
}
private
synchronized
static
native
void
setNativeFontPath
(
String
fontPath
);
// Implements SunGraphicsEnvironment.createFontConfiguration.
// Implements SunGraphicsEnvironment.createFontConfiguration.
protected
FontConfiguration
createFontConfiguration
()
{
protected
FontConfiguration
createFontConfiguration
()
{
/* The logic here decides whether to use a preconfigured
/* The logic here decides whether to use a preconfigured
...
@@ -780,7 +761,12 @@ public class X11FontManager extends SunFontManager {
...
@@ -780,7 +761,12 @@ public class X11FontManager extends SunFontManager {
preferLocaleFonts
,
preferPropFonts
);
preferLocaleFonts
,
preferPropFonts
);
}
}
public
synchronized
native
String
getFontPath
(
boolean
noType1Fonts
);
public
synchronized
native
String
getFontPathNative
(
boolean
noType1Fonts
);
public
synchronized
String
getFontPath
(
boolean
noType1Fonts
)
{
isHeadless
();
// make sure GE is inited, as its the X11 lock.
return
getFontPathNative
(
noType1Fonts
);
}
public
String
[]
getDefaultPlatformFont
()
{
public
String
[]
getDefaultPlatformFont
()
{
if
(
defaultPlatformFont
!=
null
)
{
if
(
defaultPlatformFont
!=
null
)
{
...
...
src/solaris/classes/sun/awt/motif/MToolkit.java
浏览文件 @
ad6fa056
...
@@ -120,13 +120,6 @@ public class MToolkit extends UNIXToolkit implements Runnable {
...
@@ -120,13 +120,6 @@ public class MToolkit extends UNIXToolkit implements Runnable {
getDefaultConfiguration
());
getDefaultConfiguration
());
}
}
/* Add font properties font directories to the X11 font path.
* Its called here *after* the X connection has been initialised
* and when we know that MToolkit is the one that will be used,
* since XToolkit doesn't need the X11 font path set
*/
X11FontManager
.
getInstance
().
setNativeFontPath
();
motifdnd
=
((
Boolean
)
java
.
security
.
AccessController
.
doPrivileged
(
motifdnd
=
((
Boolean
)
java
.
security
.
AccessController
.
doPrivileged
(
new
GetBooleanAction
(
"awt.dnd.motifdnd"
))).
booleanValue
();
new
GetBooleanAction
(
"awt.dnd.motifdnd"
))).
booleanValue
();
}
}
...
...
src/solaris/native/sun/awt/fontpath.c
浏览文件 @
ad6fa056
...
@@ -502,6 +502,13 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
...
@@ -502,6 +502,13 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
#ifdef __linux__
/* There's no headless build on linux ... */
#ifdef __linux__
/* There's no headless build on linux ... */
if
(
!
AWTIsHeadless
())
{
/* .. so need to call a function to check */
if
(
!
AWTIsHeadless
())
{
/* .. so need to call a function to check */
#endif
#endif
/* Using the X11 font path to locate font files is now a fallback
* useful only if fontconfig failed, or is incomplete. So we could
* remove this code completely and the consequences should be rare
* and non-fatal. If this happens, then the calling Java code can
* be modified to no longer require that the AWT lock (the X11GE)
* be initialised prior to calling this code.
*/
AWT_LOCK
();
AWT_LOCK
();
if
(
isDisplayLocal
(
env
))
{
if
(
isDisplayLocal
(
env
))
{
x11dirs
=
getX11FontPath
();
x11dirs
=
getX11FontPath
();
...
@@ -527,7 +534,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
...
@@ -527,7 +534,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
return
path
;
return
path
;
}
}
JNIEXPORT
jstring
JNICALL
Java_sun_awt_X11FontManager_getFontPath
JNIEXPORT
jstring
JNICALL
Java_sun_awt_X11FontManager_getFontPath
Native
(
JNIEnv
*
env
,
jobject
thiz
,
jboolean
noType1
)
{
(
JNIEnv
*
env
,
jobject
thiz
,
jboolean
noType1
)
{
jstring
ret
;
jstring
ret
;
static
char
*
ptr
=
NULL
;
/* retain result across calls */
static
char
*
ptr
=
NULL
;
/* retain result across calls */
...
@@ -539,71 +546,6 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath
...
@@ -539,71 +546,6 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath
return
ret
;
return
ret
;
}
}
/*
* In general setting the font path in a remote display situation is
* problematic. But for Solaris->Solaris the paths needed by the JRE should
* also be available to the server, although we have no way to check this
* for sure.
* So set the font path if we think its safe to do so:
* All Solaris X servers at least back to 2.6 and up to Solaris 10
* define the exact same vendor string.
* The version number for Solaris 2.6 is 3600, for 2.7 is 3610 and
* for Solaris 8 6410
* we want to set the font path only for 2.8 and onwards. Earlier releases
* are unlikely to have the right fonts and can't install "all locales"
* as needed to be sure. Also Solaris 8 is the earliest release supported
* by 1.5.
*/
#ifndef HEADLESS
static
int
isSunXServer
()
{
#ifdef __solaris__
return
((
strncmp
(
ServerVendor
(
awt_display
),
"Sun Microsystems, Inc."
,
22
)
==
0
)
||
(
strncmp
(
ServerVendor
(
awt_display
),
"Oracle Corporation"
,
18
)
==
0
)
&&
VendorRelease
(
awt_display
)
>=
6410
);
#else
return
0
;
#endif
/* __solaris__ */
}
/* Avoid re-doing work for every call to setNativeFontPath */
static
int
doSetFontPath
=
-
1
;
static
int
shouldSetXFontPath
(
JNIEnv
*
env
)
{
if
(
doSetFontPath
==
-
1
)
{
doSetFontPath
=
awt_display
!=
NULL
&&
(
isDisplayLocal
(
env
)
||
isSunXServer
());
}
return
doSetFontPath
;
}
#endif
/* !HEADLESS */
JNIEXPORT
void
JNICALL
Java_sun_font_X11FontManager_setNativeFontPath
(
JNIEnv
*
env
,
jclass
obj
,
jstring
theString
)
{
#ifdef HEADLESS
return
;
#else
fDirRecord
fDir
;
const
char
*
theChars
;
if
(
awt_display
==
NULL
)
{
return
;
}
AWT_LOCK
();
if
(
shouldSetXFontPath
(
env
))
{
theChars
=
(
*
env
)
->
GetStringUTFChars
(
env
,
theString
,
0
);
fDir
.
num
=
1
;
fDir
.
name
[
0
]
=
theChars
;
/* printf ("Registering the font path here %s \n", theChars ); */
AddFontsToX11FontPath
(
&
fDir
);
if
(
theChars
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
theString
,
(
const
char
*
)
theChars
);
}
}
AWT_UNLOCK
();
#endif
}
#include <dlfcn.h>
#include <dlfcn.h>
#ifndef __linux__
/* i.e. is solaris */
#ifndef __linux__
/* i.e. is solaris */
#include <link.h>
#include <link.h>
...
...
test/java/awt/FontClass/X11FontPathCrashTest.java
0 → 100644
浏览文件 @
ad6fa056
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6958221
* @summary Test no crashing getting fonts on X11
* @run main X11FontPathCrashTest
*/
import
java.awt.*
;
import
java.awt.font.*
;
import
java.awt.geom.*
;
public
class
X11FontPathCrashTest
{
public
static
void
main
(
String
[]
args
)
{
new
Font
(
"nonexistentfont"
,
Font
.
PLAIN
,
12
).
getFamily
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录