[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] What is the point of CloseTTFontFileFunc?
From:       Andrew Dinn <adinn () redhat ! com>
Date:       2014-12-29 11:03:57
Message-ID: 54A1351D.9090108 () redhat ! com
[Download RAW message or body]

Hi again,

Trying a second time . . . anyone have an answer to this question?

regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Matt Parson (USA), Charlie Peters
(USA), Michael O'Neill (Ireland)

On 19/12/14 11:08, Andrew Dinn wrote:
> Hi All,
> 
> I am looking at a problem Red Hat customers have reported with True Type
> fonts where they are seeing a Hotspot crash using JDK7. the problem
> relates to the use of TT font scalers and, in particular to code called
> under native methods initNativeScaler and disposeNativeScaler of class
> sun.font.FreetypeFontScaler.
> 
> While investigating this I looked at the stream close function
> CloseTTFontFileFunc provided for the scaler in freetypeScaler.c and was
> rather confused as to what it was supposed to achieve. n.b. the code
> below from the release version of Icedtea7 which caused the problem
> appears still to exist unchanged in the latest jdk7u, jdk8u and jdk9).
> 
> /* NB: is it ever called? */
> static void CloseTTFontFileFunc(FT_Stream stream) {
>     FTScalerInfo *scalerInfo = (FTScalerInfo *) stream->pathname.pointer;
>     JNIEnv* env = scalerInfo->env;
>     jclass tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont");
>     jfieldID platNameField =
>          (*env)->GetFieldID(env, tmpClass, "platName",
> "Ljava/lang/String;");
>     jstring platName = (*env)->GetObjectField(env,
>                                               scalerInfo->font2D,
>                                               platNameField);
>     const char *name = JNU_GetStringPlatformChars(env, platName, NULL);
>     JNU_ReleaseStringPlatformChars(env, platName, name);
> }
> 
> Is there any point in calling JNU_GetStringPlatformChars and then
> JNU_ReleaseStringPlatformChars? This appears simply to malloc a copy of
> the platname string, albeit perhaps with some multibyte chars replaced
> with '?', and then to immediately free the allocated string. Is there
> any good reason for this?
> 
> regards,
> 
> 
> Andrew Dinn
> -----------
> 
> 
> 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic