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

JavaFX fatal error when showAndWait is called in start method

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • tbd
    • jfx17
    • javafx
    • Ubuntu 20.04
      JDK 17+35
      JavaFX 18-ea

    Description

      ADDITIONAL SYSTEM INFORMATION :
      I have tried these combinations:
      JavaFX 11.0.2 with OpenJDK 17-ea+35 works fine.
      JavaFX 17-ea+8 with OpenJDK 11.0.4 works fine.
      JavaFX 17-ea+8 with OpenJDK 16.0.1 does not work.
      JavaFX 17-ea+8 with OpenJDK 17-ea+35 does not work.

      A DESCRIPTION OF THE PROBLEM :
      When TextInputDialog.showAndWait() is called and the user hits the Enter key the program sometimes crashes. This happens if showAndWait is called directly from the Application.start method, and it does not happen if the call is wrapped in Platform.runLater.

      It should be noted that clicking the OK button works fine. The crash only occurs if the dialog is closed using a key press (Esc can also cause a crash).

      The probability of a crash seems to increase if a lot of GUI elements are created prior to the call.


      It seems to crash in two slightly different ways:

      1.
      V [libjvm.so+0xa26143] Klass::method_at_vtable(int)+0x3
      V [libjvm.so+0x88ad37] jni_CallVoidMethodV+0xf7
      C [libglassgtk3.so+0x27f61] JNIEnv_::CallVoidMethod(_jobject*, _jmethodID*, ...)+0x81
      C [libglassgtk3.so+0x28b35] WindowContextBase::process_key(_GdkEventKey*)+0x1b5
      C [libglassgtk3.so+0x33f50] WindowContextBase::im_filter_keypress(_GdkEventKey*)+0x1e0
      C [libglassgtk3.so+0x31de4] process_events(_GdkEvent*, void*)+0x84

      2.
      V [libjvm.so+0x7f2777] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x1b7
      V [libjvm.so+0x887a77] jni_invoke_nonstatic(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, JavaThread*) [clone .constprop.1]+0x1f7
      V [libjvm.so+0x88ad37] jni_CallVoidMethodV+0xf7
      C [libglassgtk3.so+0x27f61] JNIEnv_::CallVoidMethod(_jobject*, _jmethodID*, ...)+0x81
      C [libglassgtk3.so+0x28b35] WindowContextBase::process_key(_GdkEventKey*)+0x1b5
      C [libglassgtk3.so+0x33f50] WindowContextBase::im_filter_keypress(_GdkEventKey*)+0x1e0
      C [libglassgtk3.so+0x31de4] process_events(_GdkEvent*, void*)+0x84

      The Java frames are the same in both cases:
      j com.sun.glass.ui.gtk.GtkApplication.enterNestedEventLoopImpl()V+0
      j com.sun.glass.ui.gtk.GtkApplication._enterNestedEventLoop()Ljava/lang/Object;+15
      j com.sun.glass.ui.Application.enterNestedEventLoop()Ljava/lang/Object;+14
      j com.sun.glass.ui.EventLoop.enter()Ljava/lang/Object;+42
      j com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(Ljava/lang/Object;)Ljava/lang/Object;+95
      j javafx.stage.Stage.showAndWait()V+93
      j javafx.scene.control.HeavyweightDialog.showAndWait()V+22
      j javafx.scene.control.Dialog.showAndWait()Ljava/util/Optional;+86

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      In Application.start() put: new TextInputDialog().showAndWait();
      Run the program and close the dialog with Enter or Esc.
      To make the crash happen more often initialize some GUI components before the call.


      CUSTOMER SUBMITTED WORKAROUND :
      Calling TextInputDialog.showAndWait() from inside Platform.runLater works

      FREQUENCY : occasionally


      Attachments

        Issue Links

          Activity

            People

              mfox Martin Fox
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: