Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GTK4] Selecting a file using "Open File" crashes Eclipse with SIGSEV #343

Closed
joel-majano opened this issue Aug 24, 2022 · 1 comment · Fixed by #345
Closed

[GTK4] Selecting a file using "Open File" crashes Eclipse with SIGSEV #343

joel-majano opened this issue Aug 24, 2022 · 1 comment · Fixed by #345
Labels
gtk4 GTK4 issues Linux/GTK Happens on Linux

Comments

@joel-majano
Copy link
Contributor

joel-majano commented Aug 24, 2022

Describe the bug
Upon selecting a file using the file dialog from "Open File" the IDE crashes.

To Reproduce
In GTK4 press "Open File" then select a text file (.txt or .c or .java, etc.) then press "Open". Eclipse will crash after pressing open.

Expected behavior
The file opens in the editor.

Screenshots

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fb47d48ad40, pid=161827, tid=161834
#
# JRE version: OpenJDK Runtime Environment 21.9 (17.0.3+7) (build 17.0.3+7)
# Java VM: OpenJDK 64-Bit Server VM 21.9 (17.0.3+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libglib-2.0.so.0+0x6dd40]  g_slist_length+0x10
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/jmajano/EclipseBuilds/eclipse-SDK-4.23/eclipse/core.161827)
#
# An error report file with more information is saved as:
# /home/jmajano/EclipseBuilds/eclipse-SDK-4.23/eclipse/hs_err_pid161827.log
#
# If you would like to submit a bug report, please visit:
#   https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=java-17-openjdk&version=36
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

See the log for more info: hs_err_pid161827.log

Seems that the function that is called right before the crash is FileDialog.computeResultChooserDialog().

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • [x ] Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Fedora 36, GTK 4.6.5

  2. JRE/JDK version
    OpenJDK Runtime Environment 21.9 (17.0.3+7) (build 17.0.3+7)

Tracked in #228

@joel-majano
Copy link
Contributor Author

Narrowed it down a bit more, FileDialog crashes if you select a file when the option SWT.MULTI is used.

In GTK3 gtk_file_chooser_get_files returns a GSList* but in GTK4, it retruns a GListModel*. The rest of the computeResultChooserDialog function assumes that we are dealing with a GSList which is incorrect.

Two lines (I believe) need to be changed using an if(GTK.GTK4) guard in FileDialog.java

  1. line 123 needs to be changed to use g_list_model_get_n_items
  2. line 128 needs to be changed to use g_list_model_get_object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gtk4 GTK4 issues Linux/GTK Happens on Linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants