Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8296654

[macos] Crash when launching JavaFX app with JDK that targets SDK 13

XMLWordPrintable

    • b13
    • aarch64
    • os_x

        ADDITIONAL SYSTEM INFORMATION :
        macOS 13.0 / Apple M1
        Java 17.0.6+1


        A DESCRIPTION OF THE PROBLEM :
        JavaFX app (simple Hello) crashes on startup when built with JDK17u on Xcode 14.1 (sdk13.0).
        Xcode 14.1 is required for Mac ports and homebrew binary builds for macOS Ventura.

        Tried the following combinations.

        * JavaFX(sdk13.0, minos11.0) + JDK 17.0.5+8(sdk12.3, minos11.0) -- no problem
        * JavaFX(sdk13.0, minos11.0) + JDK 17.0.6+1(sdk13.0, minos11.0) -- process crash

        Confirmed on aarch64 only, not sure if this can be reproduced on x86_64.

        I have identified the cause of this problem and will provide a fix code (see Workaround section). I have signed the OCA.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        * Build JDK17u with Xcode 14.1.
        * Launch the test app.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Test app launches normally.
        ACTUAL -
        Test apps do not launch and process crashes.

        ---------- BEGIN SOURCE ----------
        import javafx.application.Application;
        import javafx.scene.Scene;
        import javafx.scene.layout.BorderPane;
        import javafx.stage.Stage;

        public class HelloTest extends Application{

        @Override
        public void start(Stage primaryStage) throws Exception {
        BorderPane root = new BorderPane();

        primaryStage.setScene(new Scene(root, 400, 400));
        primaryStage.show();
        }

        public static void main(String arg[]) {
        Application.launch(arg);
        }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        diff --git a/modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m b/modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m
        index 41fc4c7c4f..48bfa1b648 100644
        --- a/modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m
        +++ b/modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m
        @@ -262,8 +262,9 @@ - (void)setFrameSize:(NSSize)newSize
             GET_MAIN_JENV;
             (*env)->CallVoidMethod(env, self->jView, jViewNotifyResize, (int)newSize.width, (int)newSize.height);
             GLASS_CHECK_EXCEPTION(env);
        -
        - [self->nsView removeTrackingRect:self->trackingRect];
        + if (self->trackingRect) {
        + [self->nsView removeTrackingRect:self->trackingRect];
        + }
             self->trackingRect = [self->nsView addTrackingRect:[self->nsView bounds] owner:self->nsView userData:nil assumeInside:NO];
         }
         
        @@ -276,14 +277,18 @@ - (void)setFrame:(NSRect)frameRect
             GET_MAIN_JENV;
             (*env)->CallVoidMethod(env, self->jView, jViewNotifyResize, (int)frameRect.size.width, (int)frameRect.size.height);
             GLASS_CHECK_EXCEPTION(env);
        + if (self->trackingRect) {
        + [self->nsView removeTrackingRect:self->trackingRect];
        + }
         
        - [self->nsView removeTrackingRect:self->trackingRect];
             self->trackingRect = [self->nsView addTrackingRect:[self->nsView bounds] owner:self->nsView userData:nil assumeInside:NO];
         }
         
         - (void)updateTrackingAreas
         {
        - [self->nsView removeTrackingRect:self->trackingRect];
        + if (self->trackingRect) {
        + [self->nsView removeTrackingRect:self->trackingRect];
        + }
             self->trackingRect = [self->nsView addTrackingRect:[self->nsView bounds] owner:self->nsView userData:nil assumeInside:NO];
         }

        FREQUENCY : always


              kcr Kevin Rushforth
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: