On 2020/07/30 12:20, Sergey Bylokhov wrote:
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?

I think it is fine as-is with my proposal (webrev.03).

AwtFont::Create() would call GetComponentForName(), then it returns component 
font name from WFontConfiguration::getTextComponentForName. It is the method 
what I fixed in this change!


Thanks,

Yasumasa

Reply via email to