On Mon, 21 Jul 2025 16:52:54 GMT, Phil Race <[email protected]> wrote:
>> Remove finalize method from CStrike.java
>>
>> This one is a bit odd in that there's already a Disposer used - and in fact
>> it involves two classes
>> CStrikeDisposer.java and its subclass - the nested class
>> CStrike.GlyphInfoCache
>> CStrike.GlyphInfoCache is tracking all the glyph image references.
>>
>> CStrikeDisposer has the full set of constructors of its superclass -
>> FontStrikeDisposer including support
>> for the native context
>>
>> And if supplied, CStrikeDisposer will call the native method
>> freeNativeScalerContext(long) to free the native context
>> but that native method does not exist !
>> And there's no CStrike.GlyphInfoCache constructor which allows it to be
>> specified
>>
>> So the fix is to add that and call the disposeNativeStrikePtr method instead.
>>
>> I also rejigged things a little so nativeStrikePtr could be final which is
>> supposed to help with the thread visibility.
>
> Phil Race has updated the pull request incrementally with one additional
> commit since the last revision:
>
> 8210765
Guess wildcard import and copyright year fix can be done..
src/java.desktop/macosx/classes/sun/font/CStrike.java line 99:
> 97:
> 98: public long getNativeStrikePtr() {
> 99: return nativeStrikePtr;
Any reason this check was removed?
I see that initNativeStrikePtr will call createNativeStrikePtr which does this
where there is no null check and it just returns what it gets so shouldn't we
check it here?
awtStrike = [AWTStrike awtStrikeForFont:awtFont tx:glyphTx invDevTx:invDevTx
style:style aaStyle:aaStyle]; // autoreleased
if (awtStrike)
{
CFRetain(awtStrike); // GC
}
JNI_COCOA_EXIT(env);
return ptr_to_jlong(awtStrike);
-------------
PR Review: https://git.openjdk.org/jdk/pull/26397#pullrequestreview-3073923632
PR Review Comment: https://git.openjdk.org/jdk/pull/26397#discussion_r2244303469