Skip to content

Commit d899d49

Browse files
authored
skip precompilation if Gtk4 fails to initialize (#241)
1 parent fd48f30 commit d899d49

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ProfileView"
22
uuid = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
33
author = ["Tim Holy <[email protected]>"]
4-
version = "1.9.0"
4+
version = "1.9.1"
55

66
[deps]
77
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
@@ -34,7 +34,7 @@ Cthulhu = "2"
3434
FileIO = "1.6"
3535
FlameGraphs = "0.2.10, 1"
3636
Graphics = "0.4, 1"
37-
Gtk4 = "0.5, 0.6, 0.7"
37+
Gtk4 = "0.7.6"
3838
GtkObservables = "2"
3939
InteractiveUtils = "1"
4040
IntervalSets = "0.2, 0.3, 0.4, 0.5, 0.6, 0.7"

src/ProfileView.jl

+7
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,9 @@ function __init__()
574574
printstyled(io, "\n`using Cthulhu` is required for `$(exc.f)`"; color=:yellow)
575575
end
576576
end
577+
if !Gtk4.initialized[]
578+
error("Gtk4 not initialized")
579+
end
577580
# by default GtkFrame uses rounded corners
578581
css="""
579582
.squared {border-radius: 0;}
@@ -607,6 +610,10 @@ let
607610
@compile_workload begin
608611
g = flamegraph(backtraces; lidict=lidict)
609612
gdict = Dict(tabname_allthreads => Dict(tabname_alltasks => g))
613+
if !Gtk4.initialized[]
614+
@warn("ProfileView precompile skipped: Gtk4 could not be initialized (are you on a headless system?)")
615+
return
616+
end
610617
win, c, fdraw = viewgui(FlameGraphs.default_colors, gdict)
611618
for obs in c.preserved
612619
if isa(obs, Observable) || isa(obs, Observables.ObserverFunction)

0 commit comments

Comments
 (0)