JavaFX密码对话框崩溃

时间:2017-09-13 12:53:20

标签: java javafx

在下面的示例中,如果用户填写密码并按Enter键,则应用程序崩溃。 这种情况发生在大约50%的时间。如果用户使用鼠标按下OK按钮,一切都按预期工作。在Suse Linux上可以看到这种行为。

是否有人有针对此行为的解决方法的提示?

转载于以下平台:

  • SUSE 13.2
  • SUSE 42.2
  • SUSE Tumbleweed

我在Windows或Mac上看不到这种行为。

JDK转载于:

  • Oracle jdk1.8.0_121
  • Oracle jdk1.8.0_131
  • Oracle jdk1.8.0_144

我无法在java 9上的预发行版中重现这一点。

import javafx.application.Application;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.PasswordField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;


public class PasswordDialogCrash extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        PasswordField passwordPasswordField = new PasswordField();
        GridPane grid = new GridPane();
        grid.add(passwordPasswordField, 1, 2);
        passwordPasswordField.setFocusTraversable(true);

        Dialog<String> dialog = new Dialog<>();
        dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK,  ButtonType.CLOSE);
        dialog.getDialogPane().setContent(grid);
        dialog.showAndWait();
        System.out.println("Done");
    }
}

结果:

# 
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fc544e6e9c8, pid=12031,     tid=0x00007fc4c6e5c700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_144-b01) (build 1.8.0_144-b01)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.144-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x6d59c8]  jni_invoke_nonstatic(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*)+0x38
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/myUser/tmp/hs_err_pid12031.log
Compiled method (c1)    2082 1045       3       java.util.concurrent.atomic.AtomicBoolean::set (14 bytes)
total in heap  [0x00007fc530f732d0,0x00007fc530f73640] = 880
relocation     [0x00007fc530f733f8,0x00007fc530f73428] = 48
main code      [0x00007fc530f73440,0x00007fc530f73560] = 288
stub code      [0x00007fc530f73560,0x00007fc530f735f0] = 144
metadata       [0x00007fc530f735f0,0x00007fc530f735f8] = 8
scopes data    [0x00007fc530f735f8,0x00007fc530f73608] = 16
scopes pcs     [0x00007fc530f73608,0x00007fc530f73638] = 48
dependencies   [0x00007fc530f73638,0x00007fc530f73640] = 8
#
# If you would like to submit a bug report, please visit:

#   http://bugreport.java.com/bugreport/crash.jsp

#

Aborted

0 个答案:

没有答案