g_param_spec_object fails on Darwin
lldb output w/ bt:
Process 96976 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2628794)
frame #0: 0x000000010030421b libgobject-2.0.0.dylib`type_node_check_conformities_UorL + 43
libgobject-2.0.0.dylib`type_node_check_conformities_UorL:
-> 0x10030421b <+43>: movl 0x14(%rax), %edx
0x10030421e <+46>: andl $0xff, %edx
0x100304224 <+52>: cmpl %edx, %ecx
0x100304226 <+54>: jg 0x10030426e ; <+126>
Target 0: (test-main) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2628794)
* frame #0: 0x000000010030421b libgobject-2.0.0.dylib`type_node_check_conformities_UorL + 43
frame #1: 0x000000010030034c libgobject-2.0.0.dylib`type_node_conforms_to_U + 44
frame #2: 0x00000001002fa4ca libgobject-2.0.0.dylib`g_type_is_a + 122
frame #3: 0x00000001002eb80a libgobject-2.0.0.dylib`g_param_spec_object + 42
frame #4: 0x000000010024037d libgenesis-shell-gtk3.dylib`genesis_shell_gtk3_monitor_provider_class_init(klass=0x0000600003018870, klass_data=0x0000000000000000) at monitor.vala:2:216
frame #5: 0x00000001002ff2f9 libgobject-2.0.0.dylib`type_class_init_Wm + 1593
frame #6: 0x00000001002fb49e libgobject-2.0.0.dylib`g_type_class_ref + 334
frame #7: 0x00000001002dc010 libgobject-2.0.0.dylib`g_object_new_valist + 176
frame #8: 0x00000001002dbc62 libgobject-2.0.0.dylib`g_object_new + 402
frame #9: 0x000000010024001c libgenesis-shell-gtk3.dylib`genesis_shell_gtk3_monitor_provider_construct(object_type=105553156293568, plugin=0x00000001038424c0, cancellable=0x0000000000000000, error=0x00007ff7bfef40b0) at monitor.vala:18:44
frame #10: 0x00000001002400ed libgenesis-shell-gtk3.dylib`genesis_shell_gtk3_monitor_provider_new(plugin=0x00000001038424c0, cancellable=0x0000000000000000, error=0x00007ff7bfef40b0) at monitor.vala:17:9
frame #11: 0x000000010023d771 libgenesis-shell-gtk3.dylib`genesis_shell_gtk3_plugin_real_activate(base=0x00000001038424c0, cancellable=0x0000000000000000, error=0x00007ff7bfef4170) at plugin.vala:23:13
frame #12: 0x000000010020d95e libgenesis.0.dylib`genesis_shell_plugin_activate(self=0x00000001038424c0, cancellable=0x0000000000000000, error=0x00007ff7bfef4170) at plugin.vala:31:3
frame #13: 0x0000000100002ca7 test-main`__lambda4_ at main.vala:13:3
frame #14: 0x0000000100002bd9 test-main`___lambda4__gtest_func at main.vala:8:2
frame #15: 0x0000000100530972 libglib-2.0.0.dylib`test_case_run + 690
frame #16: 0x000000010052d489 libglib-2.0.0.dylib`g_test_run_suite_internal + 233
frame #17: 0x000000010052d5c1 libglib-2.0.0.dylib`g_test_run_suite_internal + 545
frame #18: 0x000000010052c0f2 libglib-2.0.0.dylib`g_test_run_suite + 226
frame #19: 0x000000010052be93 libglib-2.0.0.dylib`g_test_run + 99
frame #20: 0x0000000100002b9e test-main`_vala_main(args=0x00007ff7bfef4550, args_length1=1) at main.vala:19:11
frame #21: 0x0000000100002b22 test-main`main(argc=1, argv=0x00007ff7bfef4550) at main.vala:1:9
frame #22: 0x000000010000a52e dyld`start + 462
I discovered this earlier this week and have been working on trace where the error comes from in my code. It was suspected that it was a problem with my libpeas code. However, I wrote a unit test which does not load any libpeas plugins and the failure triggers in there. This means this is a problem with GObject itself. I discovered that it has to do with the properties being defined for a specific type. This problem does not occur on Linux but does occur on Linux for some odd reason. GObject is v2.72.3 on macOS Monterey 12.5.1 21G83 on an Intel machine. The file that is experiencing this problem is here. As it is a Vala file, the generated code which is triggering this error looks like this:
static void
genesis_shell_gtk3_monitor_provider_class_init (GenesisShellGtk3MonitorProviderClass * klass,
gpointer klass_data)
{
#line 2 "../plugins/gtk3/src/provider/monitor.vala"
genesis_shell_gtk3_monitor_provider_parent_class = g_type_class_peek_parent (klass);
#line 2 "../plugins/gtk3/src/provider/monitor.vala"
g_type_class_adjust_private_offset (klass, &GenesisShellGtk3MonitorProvider_private_offset);
#line 2 "../plugins/gtk3/src/provider/monitor.vala"
G_OBJECT_CLASS (klass)->get_property = _vala_genesis_shell_gtk3_monitor_provider_get_property;
#line 2 "../plugins/gtk3/src/provider/monitor.vala"
G_OBJECT_CLASS (klass)->set_property = _vala_genesis_shell_gtk3_monitor_provider_set_property;
#line 2 "../plugins/gtk3/src/provider/monitor.vala"
G_OBJECT_CLASS (klass)->constructor = genesis_shell_gtk3_monitor_provider_constructor;
#line 2 "../plugins/gtk3/src/provider/monitor.vala"
G_OBJECT_CLASS (klass)->finalize = genesis_shell_gtk3_monitor_provider_finalize;
#line 2 "../plugins/gtk3/src/provider/monitor.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), GENESIS_SHELL_GTK3_MONITOR_PROVIDER_CONTEXT_PROPERTY, genesis_shell_gtk3_monitor_provider_properties[GENESIS_SHELL_GTK3_MONITOR_PROVIDER_CONTEXT_PROPERTY] = g_param_spec_object ("context", "context", "context", GENESIS_SHELL_TYPE_CONTEXT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
#line 2 "../plugins/gtk3/src/provider/monitor.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), GENESIS_SHELL_GTK3_MONITOR_PROVIDER_PLUGIN_PROPERTY, genesis_shell_gtk3_monitor_provider_properties[GENESIS_SHELL_GTK3_MONITOR_PROVIDER_PLUGIN_PROPERTY] = g_param_spec_object ("plugin", "plugin", "plugin", GENESIS_SHELL_GTK3_TYPE_PLUGIN, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
#line 776 "monitor.c"
The segment fault triggers on the first g_param_spec_object
call. This exact property is defined 22 other times so I am unsure what makes this one fail only on Darwin/macOS.