Диалог FileChooser вызывает дамп ядра segmentation fautl в собственном приложении javafx

У меня возникла проблема с диалоговым окном выбора файла в моем родном приложении javafx. Я использовал плагины gluon maven для нативной компиляции. Я решил попробовать образцы глюонов (https://github.com/gluonhq/gluon-samples). Я клонировал образцы и скомпилировал образец HelloFXML (с graalvm 21.0.0.2), и он работает. Далее я добавил простой диалог выбора файла в код действия внутри контроллера HelloFXML:

          public class HelloController {
        @FXML private Button button;
        @FXML private Label label;
        @FXML private ResourceBundle resources;
    
        public void initialize() {
            button.setOnAction(e -> {
                label.setText(resources.getString("label.text") + " " + System.getProperty("javafx.version"));
                label.setVisible(! label.isVisible());
                Optional<File> openFile = getOpenFile(button.getScene().getWindow(), "select a file");
                System.out.println("File: " + openFile);
            });
        }
    
        private Optional<File> getOpenFile(Window window, String title) {
            Path storedLocation = Paths.get("/tmp");
            FileChooser fileChooser = new FileChooser();
            fileChooser.setInitialDirectory(storedLocation.toFile());
            fileChooser.setTitle(title);
            File selectedFile = fileChooser.showOpenDialog(window);
            return Optional.ofNullable(selectedFile);
        }
    }

Теперь диалог выбора файла вызывает ошибку сегментации. Я пробовал Ubuntu 20.04 и 21.10. Я терплю неудачу на обоих. Я понятия не имею, почему это происходит, и не знаю, что делать. Какие-либо предложения? Пожалуйста помоги.

Изменить: вывод из mvn gluonfx:runagent:

      [INFO] --- javafx-maven-plugin:0.0.8:run (default-cli) @ hellofxml ---
[WARNING] Module name not found in <mainClass>. Module name will be assumed from module-info.java
native-image-agent: warning: file /home/steenbjerg/workspaces/gluon/gluon-samples/HelloFXML/src/main/resources/META-INF/native-image/jni-config.json for merging could not be found, skipping
native-image-agent: warning: file /home/steenbjerg/workspaces/gluon/gluon-samples/HelloFXML/src/main/resources/META-INF/native-image/reflect-config.json for merging could not be found, skipping
native-image-agent: warning: file /home/steenbjerg/workspaces/gluon/gluon-samples/HelloFXML/src/main/resources/META-INF/native-image/proxy-config.json for merging could not be found, skipping
native-image-agent: warning: file /home/steenbjerg/workspaces/gluon/gluon-samples/HelloFXML/src/main/resources/META-INF/native-image/resource-config.json for merging could not be found, skipping
native-image-agent: warning: file /home/steenbjerg/workspaces/gluon/gluon-samples/HelloFXML/src/main/resources/META-INF/native-image/serialization-config.json for merging could not be found, skipping
File: Optional[/home/steenbjerg/hs_err_pid22530.log]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Вывод при запуске приложения:

      steenbjerg@fin-laptop:~/workspaces/gluon/gluon-samples/HelloFXML$ target/gluonfx/x86_64-linux/HelloFXML 
Dec 15, 2021 9:47:53 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @22efd165'
Segmentation fault (core dumped)

Вывод из gdb:

      gdb target/gluonfx/x86_64-linux/HelloFXML 
GNU gdb (Ubuntu 11.1-0ubuntu2) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from target/gluonfx/x86_64-linux/HelloFXML...
(gdb) run
Starting program: /home/steenbjerg/workspaces/gluon/gluon-samples/HelloFXML/target/gluonfx/x86_64-linux/HelloFXML 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff37ff640 (LWP 48907)]
Dec 15, 2021 10:15:24 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @32b0876c'
[New Thread 0x7ffff2dff640 (LWP 48908)]
[New Thread 0x7fffea4e6640 (LWP 48909)]
[New Thread 0x7fffe9ce5640 (LWP 48910)]
[Thread 0x7fffe9ce5640 (LWP 48910) exited]
[New Thread 0x7fffe9ce5640 (LWP 48911)]
[New Thread 0x7fffe8f73640 (LWP 48912)]
[New Thread 0x7fffde797640 (LWP 48913)]
[New Thread 0x7fffddf96640 (LWP 48914)]
[New Thread 0x7fffdd795640 (LWP 48915)]
[New Thread 0x7fffdcf94640 (LWP 48916)]
[New Thread 0x7fffbffff640 (LWP 48917)]
[New Thread 0x7fffbf1ff640 (LWP 48918)]
[New Thread 0x7fffbe7ff640 (LWP 48919)]
[Thread 0x7fffbe7ff640 (LWP 48919) exited]
[New Thread 0x7fffbe7ff640 (LWP 48920)]
[New Thread 0x7fffbd33e640 (LWP 48921)]
[New Thread 0x7fff9ffff640 (LWP 48932)]
[New Thread 0x7fff9edc2640 (LWP 48933)]
[New Thread 0x7fff9e5c1640 (LWP 48934)]
[Thread 0x7fff9edc2640 (LWP 48933) exited]
[Thread 0x7fff9e5c1640 (LWP 48934) exited]

Thread 9 "lication Thread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffddf96640 (LWP 48914)]
0x00007fffbc37f16c in ?? ()
(gdb) bt
#0  0x00007fffbc37f16c in  ()
#1  0x00007ffff659bfdb in hb_face_reference_table () at /lib/x86_64-linux-gnu/libharfbuzz.so.0
#2  0x00007ffff65c1bbd in  () at /lib/x86_64-linux-gnu/libharfbuzz.so.0
#3  0x00007ffff65f6842 in hb_ot_metrics_get_position () at /lib/x86_64-linux-gnu/libharfbuzz.so.0
#4  0x00007ffff6ca7fce in pango_fc_font_create_base_metrics_for_context () at /lib/x86_64-linux-gnu/libpangoft2-1.0.so.0
#5  0x00007ffff68438dd in  () at /lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
#6  0x00007ffff725ed5b in  () at /lib/x86_64-linux-gnu/libpango-1.0.so.0
#7  0x00007ffff725f6ff in  () at /lib/x86_64-linux-gnu/libpango-1.0.so.0
#8  0x00007ffff725506a in  () at /lib/x86_64-linux-gnu/libpango-1.0.so.0
#9  0x00007ffff72553f7 in  () at /lib/x86_64-linux-gnu/libpango-1.0.so.0
#10 0x00007ffff75c5fa0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007ffff75050e7 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x00007ffff751568d in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#13 0x00007ffff75c0337 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#14 0x00007ffff767c731 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#15 0x00007ffff767d25e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#16 0x00007ffff74c0367 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#17 0x00007ffff75050e7 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#18 0x00007ffff751568d in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#19 0x00007ffff74b94c7 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#20 0x00007ffff767c731 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#21 0x00007ffff767d25e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#22 0x00007ffff767c731 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#23 0x00007ffff767d25e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#24 0x00007ffff74b4849 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#25 0x00007ffff765a31a in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#26 0x00007ffff767c731 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#27 0x00007ffff767d25e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#28 0x00007ffff75050e7 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#29 0x00007ffff751568d in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#30 0x00007ffff75d3f9b in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#31 0x00007ffff767c731 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#32 0x00007ffff767d25e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#33 0x00007ffff75d683a in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#34 0x00007ffff75050e7 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#35 0x00007ffff751568d in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#36 0x00007ffff75d69b0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#37 0x00007ffff75050e7 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#38 0x00007ffff751568d in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#39 0x00007ffff75d3e5e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#40 0x00007ffff767c786 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#41 0x00007ffff767d309 in gtk_widget_get_preferred_height () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#42 0x00007ffff772388f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#43 0x00007ffff7723cbb in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#44 0x00007ffff6ed2866 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#45 0x00007ffff6ed4ab9 in g_object_set_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#46 0x00007ffff6ed4d64 in g_object_set () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#47 0x00007ffff7664f35 in gtk_scrolled_window_set_hadjustment () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#48 0x00007ffff6ed2866 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#49 0x00007ffff6ed2c44 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#50 0x00007ffff6ed3ed5 in g_object_newv () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#51 0x00007ffff74c36be in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#52 0x00007ffff74c3c8f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#53 0x00007ffff74c4a97 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#54 0x00007ffff6dd1e7b in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#55 0x00007ffff6dd3217 in g_markup_parse_context_parse () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#56 0x00007ffff74bce16 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#57 0x00007ffff74bd6f4 in gtk_builder_extend_with_template () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#58 0x00007ffff773b166 in gtk_widget_init_template () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#59 0x00007ffff757ba2d in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#60 0x00007ffff6eeb24a in g_type_create_instance () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#61 0x00007ffff6ed2b7d in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#62 0x00007ffff6ed3ed5 in g_object_newv () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#63 0x00007ffff74c36be in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#64 0x00007ffff74c3c8f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#65 0x00007ffff74c4a97 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#66 0x00007ffff6dd1e7b in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#67 0x00007ffff6dd3217 in g_markup_parse_context_parse () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#68 0x00007ffff74bce16 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#69 0x00007ffff74bd6f4 in gtk_builder_extend_with_template () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#70 0x00007ffff773b166 in gtk_widget_init_template () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#71 0x00007ffff7569276 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#72 0x00007ffff6eeb24a in g_type_create_instance () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#73 0x00007ffff6ed2b7d in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#74 0x00007ffff6ed40f8 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#75 0x00007ffff6ed462d in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#76 0x00007ffff756973d in gtk_file_chooser_dialog_new () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#77 0x0000555557105c31 in Java_com_sun_glass_ui_gtk_GtkCommonDialogs__1showFileChooser ()
#78 0x0000555555aeaca5 in GtkCommonDialogs__showFileChooser_08da0bf2d9d85e336b1e9066f92ea815f4c4a69f ()
#79 0xffffffff00000000 in  ()
#80 0x0000555500000000 in  ()
#81 0x0000000000000005 in  ()
#82 0x0000555500000000 in  ()
#83 0x00007fffbc427a38 in  ()
#84 0x00007fffbc427a38 in  ()
#85 0x00007ffff508e308 in  ()
#86 0x00007ffff4144aa0 in  ()
#87 0x00007fffbc427ce8 in  ()
#88 0x0000000100744aa0 in  ()
#89 0x000000010168e308 in  ()
#90 0x0000000000000004 in  ()
#91 0x0000000100699080 in  ()
--Type <RET> for more, q to quit, c to continue without paging--
#92 0x0000000255ae17b6 in  ()
#93 0x00007fffcc276f90 in  ()
#94 0x0000000000000000 in  ()

0 ответов

Другие вопросы по тегам