On Thu, 4 Dec 2025 03:05:48 GMT, Alexander Zuev <[email protected]> wrote:

>>>Hi! The fix you are pointing to is marked as pending OCA approval.
>> 
>> The oca tag is deleted from that PR.
>
>> > Hi! The fix you are pointing to is marked as pending OCA approval.
>> 
>> The oca tag is deleted from that PR.
> 
> I see. The difference is not substantial (the second check is not required 
> since passing nil will not break the logic - we will return nil anyways just 
> a bit later and releasing of the java object in my testing caused crash by 
> itself in quick repeated invocations of popup without closing previous popup) 
> so i'm going to integrate the fix. And since we both came to pretty much the 
> same fix i will add credit to this PR for the author of JetBrains version of 
> the fix.

Thanks @azuev-java. I can clarify that I had the second check

    if (currentElement == nil) {
        return nil;
    }

because `nil` is one of the possible return values of 
`[CommonComponentAccessibility createWithAccessible...]`. Even though normally 
it shouldn't be returned there, I wanted to be safe for any possible edge 
cases. 

Regarding the crash with `DeleteLocalRef`, could you please elaborate on that? 
What was the crash stack trace? I can't reproduce it myself, and by reading the 
code I don't see how deleting the reference to `axComponent` could affect 
anything outside `accessibilityChildren`. From what I understand, all calls to 
`accessibilityChildren` will be sequential on the same AppKit thread, so I'm 
also not sure how having multiple instances of popups could affect it.

But indeed it's enough to only add the check for `axComponent == nil` to 
prevent the crash, so the main issue is fixed, and these are less important 
points.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28614#issuecomment-3611999493

Reply via email to