8017580: Crash in font loading code on Linux (due to use of reflection)
Reviewed-by: bae, vadim
This commit is contained in:
parent
f09520a064
commit
1dd31aff63
@ -71,13 +71,17 @@ JNIEXPORT jlong JNICALL Java_sun_font_NullFontScaler_getGlyphImage
|
|||||||
void initLCDGammaTables();
|
void initLCDGammaTables();
|
||||||
|
|
||||||
/* placeholder for extern variable */
|
/* placeholder for extern variable */
|
||||||
|
static int initialisedFontIDs = 0;
|
||||||
FontManagerNativeIDs sunFontIDs;
|
FontManagerNativeIDs sunFontIDs;
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
static void initFontIDs(JNIEnv *env) {
|
||||||
Java_sun_font_SunFontManager_initIDs
|
|
||||||
(JNIEnv *env, jclass cls) {
|
|
||||||
|
|
||||||
jclass tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont");
|
jclass tmpClass;
|
||||||
|
|
||||||
|
if (initialisedFontIDs) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont");
|
||||||
sunFontIDs.ttReadBlockMID =
|
sunFontIDs.ttReadBlockMID =
|
||||||
(*env)->GetMethodID(env, tmpClass, "readBlock",
|
(*env)->GetMethodID(env, tmpClass, "readBlock",
|
||||||
"(Ljava/nio/ByteBuffer;II)I");
|
"(Ljava/nio/ByteBuffer;II)I");
|
||||||
@ -173,9 +177,20 @@ Java_sun_font_SunFontManager_initIDs
|
|||||||
(*env)->GetFieldID(env, tmpClass, "lcdSubPixPos", "Z");
|
(*env)->GetFieldID(env, tmpClass, "lcdSubPixPos", "Z");
|
||||||
|
|
||||||
initLCDGammaTables();
|
initLCDGammaTables();
|
||||||
|
|
||||||
|
initialisedFontIDs = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT FontManagerNativeIDs getSunFontIDs() {
|
JNIEXPORT void JNICALL
|
||||||
|
Java_sun_font_SunFontManager_initIDs
|
||||||
|
(JNIEnv *env, jclass cls) {
|
||||||
|
|
||||||
|
initFontIDs(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) {
|
||||||
|
|
||||||
|
initFontIDs(env);
|
||||||
return sunFontIDs;
|
return sunFontIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ typedef struct FontManagerNativeIDs {
|
|||||||
/* Note: we share variable in the context of fontmanager lib
|
/* Note: we share variable in the context of fontmanager lib
|
||||||
but we need access method to use it from separate rasterizer lib */
|
but we need access method to use it from separate rasterizer lib */
|
||||||
extern FontManagerNativeIDs sunFontIDs;
|
extern FontManagerNativeIDs sunFontIDs;
|
||||||
JNIEXPORT FontManagerNativeIDs getSunFontIDs();
|
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv* env);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user