提交 7c3fe440 编写于 作者: A aivanov

8160664: JVM crashed with font manager on Solaris 12

Reviewed-by: prr, aivanov
Contributed-by: NMartin Walsh <martin.walsh@oracle.com>
上级 83f61f63
/* /*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -804,30 +804,36 @@ static char **getFontConfigLocations() { ...@@ -804,30 +804,36 @@ static char **getFontConfigLocations() {
pattern = (*FcPatternBuild)(NULL, FC_OUTLINE, FcTypeBool, FcTrue, NULL); pattern = (*FcPatternBuild)(NULL, FC_OUTLINE, FcTypeBool, FcTrue, NULL);
objset = (*FcObjectSetBuild)(FC_FILE, NULL); objset = (*FcObjectSetBuild)(FC_FILE, NULL);
fontSet = (*FcFontList)(NULL, pattern, objset); fontSet = (*FcFontList)(NULL, pattern, objset);
fontdirs = (char**)calloc(fontSet->nfont+1, sizeof(char*)); if (fontSet == NULL) {
for (f=0; f < fontSet->nfont; f++) { /* FcFontList() may return NULL if fonts are not installed. */
FcChar8 *file; fontdirs = NULL;
FcChar8 *dir; } else {
if ((*FcPatternGetString)(fontSet->fonts[f], FC_FILE, 0, &file) == fontdirs = (char**)calloc(fontSet->nfont+1, sizeof(char*));
FcResultMatch) { for (f=0; f < fontSet->nfont; f++) {
dir = (*FcStrDirname)(file); FcChar8 *file;
found = 0; FcChar8 *dir;
for (i=0;i<numdirs; i++) { if ((*FcPatternGetString)(fontSet->fonts[f], FC_FILE, 0, &file) ==
if (strcmp(fontdirs[i], (char*)dir) == 0) { FcResultMatch) {
found = 1; dir = (*FcStrDirname)(file);
break; found = 0;
for (i=0;i<numdirs; i++) {
if (strcmp(fontdirs[i], (char*)dir) == 0) {
found = 1;
break;
}
}
if (!found) {
fontdirs[numdirs++] = (char*)dir;
} else {
free((char*)dir);
} }
}
if (!found) {
fontdirs[numdirs++] = (char*)dir;
} else {
free((char*)dir);
} }
} }
/* Free fontset if one was returned */
(*FcFontSetDestroy)(fontSet);
} }
/* Free memory and close the ".so" */ /* Free memory and close the ".so" */
(*FcFontSetDestroy)(fontSet);
(*FcPatternDestroy)(pattern); (*FcPatternDestroy)(pattern);
closeFontConfig(libfontconfig, JNI_TRUE); closeFontConfig(libfontconfig, JNI_TRUE);
return fontdirs; return fontdirs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册