Skip to content

skip precompilation if Gtk4 fails to initialize #241

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

Merged
merged 3 commits into from
Feb 22, 2025
Merged

Conversation

jwahlstrand
Copy link
Collaborator

@jwahlstrand jwahlstrand commented Feb 15, 2025

Previously, on a headless system ProfileView would fail to precompile because Gtk4 refused to start if the C library's init_check method failed. Gtk4 now allows it to fail, but we can't precompile because calling any C library methods without initializing the C library first causes a segmentation fault. With this PR, ProfileView checks if Gtk4 was initialized and skips precompilation if it wasn't. The cost is TTFX if precompilation was done in a headless situation (for example through an SSH connection).

Fixes #219.

@@ -568,6 +568,10 @@ function __init__()
printstyled(io, "\n`using Cthulhu` is required for `$(exc.f)`"; color=:yellow)
end
end
if !Gtk4.initialized[]
error("Gtk4 not initialized")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be an @error or is the return afterwards surplus?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, the return is not needed -- I just removed it.

@IanButterworth IanButterworth merged commit d899d49 into master Feb 22, 2025
9 checks passed
@IanButterworth IanButterworth deleted the jw/headless branch February 22, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't precompile without a display
2 participants