Error `GLib.SettingsSchemaSource.lookup: source != NULL` when calling `adw_init` on MacOS / Windows

I maintain a library that uses GTK4 / Adwaita as a dependency. When running a GApplication, Windows and macOS users are reporting the following error message:

(test:82330): GLib-GIO-CRITICAL **: 01:37:23.627: g_settings_schema_source_lookup: assertion 'source != NULL' failed

I assume this is due to the system not having a GTK4/settings.ini file accessible. If this is the case, how do I prevent this error? Installation of a global settings.ini to the users operating system is not an acceptable solution for me, the library should be completely self-contained with no installation necessary. Is there a way to tell the GApplication to look for the settings in a local folder I can ship along with the library?

Hello, @Clemapfel!

Shipping a settings.ini file is unnecessary as GTK4 will look for settings in the system. Most probably it’s due to missing GIO settings XML files, see Ubuntu Manpage: glib-compile-schemas - GSettings schema compiler

Could you run your application with the environment variable G_DEBUG=fatal-criticals and obtain a stacktrace?

2 Likes

Hi, thank you for the reply.

I narrowed it down to a MWE, which is just adw_init(). The stracktrace is:

(process:10512): GLib-GIO-CRITICAL **: 15:29:41.923: g_settings_schema_source_lookup: assertion 'source != NULL' failed

[10512] signal (22): SIGABRT
in expression starting at REPL[12]:1
crt_sig_handler at C:/workdir/src\signals-win.c:95
raise at C:\WINDOWS\System32\msvcrt.dll (unknown line)
abort at C:\WINDOWS\System32\msvcrt.dll (unknown line)
g_abort at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libglib-2.0-0.dll (unknown line)
g_logv at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libglib-2.0-0.dll (unknown line)
g_log at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libglib-2.0-0.dll (unknown line)
g_return_if_fail_warning at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libglib-2.0-0.dll (unknown line)
g_settings_schema_source_lookup at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libgio-2.0-0.dll (unknown line)
init_gsettings at C:\Users\cleme\.julia\artifacts\f75b47853676d7d7d1040f6e3facb2d7e3dd98f4\bin\libadwaita-1-0.dll (unknown line)
adw_settings_constructed at C:\Users\cleme\.julia\artifacts\f75b47853676d7d7d1040f6e3facb2d7e3dd98f4\bin\libadwaita-1-0.dll (unknown line)
g_object_new_internal.constprop.29 at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libgobject-2.0-0.dll (unknown line)
g_object_new_with_properties.constprop.28 at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libgobject-2.0-0.dll (unknown line)
g_object_new at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libgobject-2.0-0.dll (unknown line)
adw_settings_get_default at C:\Users\cleme\.julia\artifacts\f75b47853676d7d7d1040f6e3facb2d7e3dd98f4\bin\libadwaita-1-0.dll (unknown line)
adw_style_manager_constructed at C:\Users\cleme\.julia\artifacts\f75b47853676d7d7d1040f6e3facb2d7e3dd98f4\bin\libadwaita-1-0.dll (unknown line)
g_object_new_internal.constprop.29 at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libgobject-2.0-0.dll (unknown line)
g_object_new_with_properties.constprop.28 at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libgobject-2.0-0.dll (unknown line)
g_object_new at C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\bin\libgobject-2.0-0.dll (unknown line)
adw_style_manager_ensure at C:\Users\cleme\.julia\artifacts\f75b47853676d7d7d1040f6e3facb2d7e3dd98f4\bin\libadwaita-1-0.dll (unknown line)
.text at C:\Users\cleme\.julia\artifacts\f75b47853676d7d7d1040f6e3facb2d7e3dd98f4\bin\libadwaita-1-0.dll (unknown line)
top-level scope at .\REPL[12]:1
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:903
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:856
ijl_toplevel_eval at C:/workdir/src\toplevel.c:921 [inlined]
ijl_toplevel_eval_in at C:/workdir/src\toplevel.c:971
eval at .\boot.jl:370 [inlined]
eval_user_input at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:153
repl_backend_loop at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:249
#start_repl_backend#46 at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:234
start_repl_backend at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:231
#run_repl#59 at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:379
run_repl at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:365
jfptr_run_repl_61185 at C:\Users\cleme\AppData\Local\Programs\Julia-1.9.2\lib\julia\sys.dll (unknown line)
#1017 at .\client.jl:421
jfptr_YY.1017_34710 at C:\Users\cleme\AppData\Local\Programs\Julia-1.9.2\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
jl_f__call_latest at C:/workdir/src\builtins.c:774
#invokelatest#2 at .\essentials.jl:816 [inlined]
invokelatest at .\essentials.jl:813 [inlined]
run_main_repl at .\client.jl:405
exec_options at .\client.jl:322
_start at .\client.jl:522
jfptr__start_47602 at C:\Users\cleme\AppData\Local\Programs\Julia-1.9.2\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
true_main at C:/workdir/src\jlapi.c:573
jl_repl_entrypoint at C:/workdir/src\jlapi.c:717
mainCRTStartup at C:/workdir/cli\loader_exe.c:59
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
Allocations: 16844204 (Pool: 16822301; Big: 21903); GC: 26

It seems that adw_settings_get_default is unable to find settings file during startup, though I may be wrong about this.

After more testing, only adw_init causes the error, gtk_init works fine. I’m not sure what this means but hopefully that helps narrow it down.

Ok, LibAdwaita tries to open a GSettings XML schema (src/adw-settings.c · d7307a4b · GNOME / libadwaita · GitLab and src/adw-settings-impl-gsettings.c · d7307a4b · GNOME / libadwaita · GitLab) but g_settings_schema_source_get_default returns NULL

Create the folder C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\share\glib-2.0\schemas and download these files:

You should also have glib-compile-schemas.exe in your bin directory. Open a command prompt and run glib-compile-schemas C:\Users\cleme\.julia\artifacts\4f67e82ee394e74ca63b7dc589dcc9218c12b20a\share\glib-2.0\schemas. This will create a gschemas.compiled file in the target directory

Once that is done you should be able to start the application without issues!

1 Like

This worked, thank you so much!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.