<AWT Dev> [OpenJDK 2D-Dev] PING: RFR: 8249215: JFrame::setVisible crashed with -Dfile.encoding=UTF-8

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu Jul 30 03:20:04 UTC 2020


On 29.07.2020 19:37, Yasumasa Suenaga wrote:
> On 2020/07/30 11:03, Sergey Bylokhov wrote:
>> On 28.07.2020 18:52, Yasumasa Suenaga wrote:
>>> Hi Phil, Sergey,
>>>
>>> Sorry, I missed. null is WComponentPeer::pData, not defaultFont.
>>
>> Could you please clarify in what exact place access to the null pData in WComponentPeer caused a crash?
> 
> src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
> 
> 6032         AwtFont *awtFont = (AwtFont *)env->GetLongField(font, AwtFont::pDataID);
> 6033         if (awtFont == NULL) {
> 6034             /*arguments of AwtFont::Create are changed for multifont component */
> 6035             awtFont = AwtFont::Create(env, font);
> 6036         }
> 6037         env->SetLongField(font, AwtFont::pDataID, (jlong)awtFont);
> 6038
> 6039         c->SetFont(awtFont); // <--
> 
> awtFont in above is NULL.

So the reason is that AwtFont::Create returns NULL, and if you take a look to that method
there are a few cases when we could return NULL or return 0. Should not all that "returns"
be removed? or all results of its usage wrapped by the "if(awtFont!=null)".
Or it is fine as-is?


-- 
Best regards, Sergey.


More information about the awt-dev mailing list