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

macOS: programs using g_get_os_info() are crashing #257

Closed
vmagnin opened this issue Apr 24, 2022 · 2 comments
Closed

macOS: programs using g_get_os_info() are crashing #257

vmagnin opened this issue Apr 24, 2022 · 2 comments
Assignees
Labels
Bug Crash The application do not run or crash during running GTK 4 GTK 4 only macOS mac specific
Milestone

Comments

@vmagnin
Copy link
Owner

vmagnin commented Apr 24, 2022

Describe the bug
In gtk-fortran 4.2.0, examples/tests.f90, examples/bazaar.f90 and src/gtk-fortran.f90 are crashing (segmentation fault), only on macOS.

Your system:

  • OS version: macOS 10.15.7
  • Compiler version: gfortran
  • GTK branch: gtk4, gtk-fortran 4.2.0
@vmagnin vmagnin added Bug macOS mac specific GTK 4 GTK 4 only Crash The application do not run or crash during running labels Apr 24, 2022
@vmagnin vmagnin added this to the 4.2.1 milestone Apr 24, 2022
@vmagnin vmagnin self-assigned this Apr 24, 2022
@vmagnin
Copy link
Owner Author

vmagnin commented Apr 24, 2022

The problem comes from the GLib g_get_os_info() function:

call c_f_string_copy(g_get_os_info("PRETTY_NAME"//c_null_char), os_string)

The GLib doc (https://docs.gtk.org/glib/func.get_os_info.html) says it returns NULL if this information is not provided. That is the case under macOS.

@vmagnin
Copy link
Owner Author

vmagnin commented Apr 24, 2022

Solution:

    type(c_ptr) :: ret

    ret = g_get_os_info("PRETTY_NAME"//c_null_char)
    if (c_associated(ret)) then
      call c_f_string_copy(ret, os_string)
    else
      os_string = "?"
    end if

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Crash The application do not run or crash during running GTK 4 GTK 4 only macOS mac specific
Projects
None yet
Development

No branches or pull requests

1 participant