Integrated: 8231558: [macos] Platform.exit causes assertion error on macOS 10.15 or later

Kevin Rushforth kevin.rushforth at oracle.com
Thu Jul 1 12:26:17 UTC 2021


Unrelated, since this fix is in macOS-specific platform code.

-- Kevin


On 7/1/2021 4:33 AM, Ty Young wrote:
> Does this also fix the free(): invalid pointer issue when closing a 
> JavaFX application on Linux or is that unrelated?
>
>
> On 7/1/21 6:17 AM, Kevin Rushforth wrote:
>> On Tue, 22 Jun 2021 20:42:48 GMT, Kevin Rushforth <kcr at openjdk.org> 
>> wrote:
>>
>>> This is a fix for the assertion error message that is printed to the 
>>> console on macOS 10.15 or later when an application calls 
>>> `Platform.exit` while a `Stage` is showing.
>>>
>>> The root cause is a latent bug in the JavaFX glass code that was 
>>> revealed by an apparent change of behavior in macOS. A few of the 
>>> object deallocation methods, which are called by the Objective C 
>>> auto-release mechanism, use the standard `GET_MAIN_JENV` macro to 
>>> get the JNI environment. The macro will print an assertion warning 
>>> if Java has been detached. I instrumented the code and can see that 
>>> `GlassViewDelegate::dealloc` is now called after the 
>>> `GlassApplication` main loop has detached Java. Since we don't 
>>> control when the dealloc method is called, it is not correct to do 
>>> the assertion check in those cases. Some of the dealloc methods 
>>> already skip this assertion check by grabbing the jEnv pointer 
>>> directly, so we need to fix the others. I added a new variant of the 
>>> macro called `GET_MAIN_JENV_NOWARN` with a comment indicating that 
>>> is suitable for use by the dealloc methods.
>>>
>>> In addition to verifying that the test program attached to JBS now 
>>> exits cleanly with no assertion failure message, I added an 
>>> automated system test that fails on macOS before the fix and passes 
>>> after the fix. On other platforms it passes already.
>> This pull request has now been integrated.
>>
>> Changeset: 6403d674
>> Author:    Kevin Rushforth <kcr at openjdk.org>
>> URL: 
>> https://git.openjdk.java.net/jfx/commit/6403d6745578887b7f2ccc10ac02e7cdd04d09c1
>> Stats:     208 lines in 7 files changed: 204 ins; 0 del; 4 mod
>>
>> 8231558: [macos] Platform.exit causes assertion error on macOS 10.15 
>> or later
>>
>> Reviewed-by: pbansal, aghaisas
>>
>> -------------
>>
>> PR: https://git.openjdk.java.net/jfx/pull/540



More information about the openjfx-dev mailing list