<AWT Dev> Review request for 8165829: Android Studio 2.x crashes with NPE at sun.lwawt.macosx.CAccessibility.getAccessibleIndexInParent

Pete Brunet peter.brunet at oracle.com
Tue Sep 27 13:43:46 UTC 2016


OK.  Looks good then.

On 9/27/16 8:37 AM, Anton Tarasov wrote:
> But it returns an array which is an object and you don’t have the original unboxing issue.
>
> Anton.
>
>> On 27 Sep 2016, at 15:57, Pete Brunet <peter.brunet at oracle.com> wrote:
>>
>> Anton, It looks like you need to also update getInitialAttributeStates. 
>> -Pete
>>
>> On 9/16/16 12:49 PM, Anton Tarasov wrote:
>>> On 9/16/2016 1:32 PM, Sergey Bylokhov wrote:
>>>> On 15.09.16 14:48, Anton Tarasov wrote:
>>>>>> Yes, and my suggestion was to use the new method and default values
>>>>>> everywhere instead of invokeAndWait(Callable,Component).
>>>>> But the default value for a reference would be null, there's no need to
>>>>> request something else, unlike for primitive wrappers.
>>>>>
>>>>> Or your idea is to force passing a def value anyway?
>>>> If the references like Point from getLocationOnScreen() can be null,
>>>> then ok. looks fine.
>>> Yes, it can.
>>>
>>> Anton.
>>>
>>>>> Anton.
>>>>>
>>>>>>>> On 15.09.16 12:45, Anton Tarasov wrote:
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> Please review the fix:
>>>>>>>>>
>>>>>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8165829
>>>>>>>>> webrev: http://cr.openjdk.java.net/~ant/JDK-8165829/jdk9/webrev.0
>>>>>>>>>
>>>>>>>>> (The bug is currently closed as “not an issue”, which is not quite
>>>>>>>>> true.
>>>>>>>>> So once and if the fix is approved I can take the ownership of the
>>>>>>>>> bug).
>>>>>>>>>
>>>>>>>>> The problem is this. Sometimes when a frame is closed there may
>>>>>>>>> appear a
>>>>>>>>> race condition:
>>>>>>>>>
>>>>>>>>> - removeNotify() is called on the frame on EDT and it removes
>>>>>>>>> all the
>>>>>>>>> events associated with the frame from the event queue.
>>>>>>>>>
>>>>>>>>> - The frame is requested by accessibility via the CAccessibility
>>>>>>>>> static
>>>>>>>>> methods (like CAccessibility.getAccessibleIndexInParent). Those
>>>>>>>>> methods
>>>>>>>>> are called from native on AppKit thread and they perform via
>>>>>>>>> invokeAndWait. The latter is wrapped with an InvocationEvent whose
>>>>>>>>> source is set to the frame. But, once the event is put on the event
>>>>>>>>> queue, it's purged by the removeNotify() call. As the result,
>>>>>>>>> invokeAndWait returns null. Then, in some of the mentioned methods
>>>>>>>>> 'null' is unboxed to a primitive 'int' or 'boolean' which results
>>>>>>>>> in NPE
>>>>>>>>> propagated to native. On the native side, the NPE is not properly
>>>>>>>>> handled and is just re-thrown.
>>>>>>>>>
>>>>>>>>> I don't have a simple and safe solution for the race. So, I
>>>>>>>>> suggest to
>>>>>>>>> fix the NPE/crash at least.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Anton.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>
>>>>



More information about the awt-dev mailing list