You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use a constraint-based layout, but doing so resulted in SIGSEGV when trying to load from a description. I've minimized the test case as best as I can here:
(Some goroutines elided.) Notice the failure in g_hash_table_unref. A backtrace from gdb isn't super revealing to me:
#0 0x00007ffff700ce59 in free () at /usr/lib/libc.so.6
#1 0x00007ffff7c45c13 in () at /usr/lib/libglib-2.0.so.0
#2 0x00007ffff7c49ca4 in g_hash_table_unref () at /usr/lib/libglib-2.0.so.0
#3 0x00000000005b29a4 in runtime.asmcgocall () at /usr/lib/go/src/runtime/asm_amd64.s:848
#4 0x00007ffff59e38c0 in ()
#5 0x00007fffffffc668 in ()
#6 0x000000000055a7ce in runtime.persistentalloc.func1 () at /usr/lib/go/src/runtime/malloc.go:1393
#7 0x00000000005b0b29 in runtime.systemstack () at /usr/lib/go/src/runtime/asm_amd64.s:496
#8 0x00007fffffffcc58 in ()
#9 0x0000000000df9290 in ()
#10 0x0000000000d2ae40 in runtime.m0 ()
#11 0x00007fffffffc6e0 in ()
#12 0x00000000005cf55d in crosscall2 () at /usr/lib/go/src/runtime/cgo/asm_amd64.s:30
#13 0x00000000007b76e6 in _gotk4_gio2_Application_ConnectActivate (arg0=0x1c4, arg1=0xc00013b738) at _cgo_export.c:1037
#14 0x00007ffff7d59210 in g_closure_invoke () at /usr/lib/libgobject-2.0.so.0
#15 0x00007ffff7d86eb8 in () at /usr/lib/libgobject-2.0.so.0
#16 0x00007ffff7d76f85 in g_signal_emit_valist () at /usr/lib/libgobject-2.0.so.0
#17 0x00007ffff7d77214 in g_signal_emit () at /usr/lib/libgobject-2.0.so.0
#18 0x00007ffff7e9b389 in () at /usr/lib/libgio-2.0.so.0
#19 0x00007ffff7ea66dc in g_application_run () at /usr/lib/libgio-2.0.so.0
#20 0x00000000007c2c7e in _cgo_8ebff343743b_Cfunc_g_application_run (v=0xc00013be20) at /tmp/go-build/cgo-gcc-prolog:453
#21 0x00000000005b29a4 in runtime.asmcgocall () at /usr/lib/go/src/runtime/asm_amd64.s:848
Looking at the generated source, I note that the g_hash_table has functions specified to free both keys and values (https://github.com/diamondburned/gotk4/blob/pkg/v0.0.4/pkg/gtk/v4/gtkconstraintlayout.go#L394). However, it's not clear to me that the value involved (a GObject for the target) is allocated on the C heap vs the go heap, or that it should be freed at any point in the process of adding constraints from a description.
Follow-up: this seems to be because the GLib.HashTable case in gocConvertNested claims to only support map[string]string but this is not map[string]string. The code that checks this case outputs a Debug statement, but does not return early, leading to the attempt to convert: https://github.com/diamondburned/gotk4/blame/pkg/v0.0.4/gir/girgen/types/typeconv/go-c.go#L406. The conversion code thinks it owns the objects involved due to the conversion for the string type operating that way, but that's not applicable in this case.
I was trying to use a constraint-based layout, but doing so resulted in SIGSEGV when trying to load from a description. I've minimized the test case as best as I can here:
Specifying a non-empty
views
is required for the crash. Here's the go backtrace:(Some goroutines elided.) Notice the failure in g_hash_table_unref. A backtrace from gdb isn't super revealing to me:
Looking at the generated source, I note that the g_hash_table has functions specified to free both keys and values (https://github.com/diamondburned/gotk4/blob/pkg/v0.0.4/pkg/gtk/v4/gtkconstraintlayout.go#L394). However, it's not clear to me that the value involved (a GObject for the target) is allocated on the C heap vs the go heap, or that it should be freed at any point in the process of adding constraints from a description.
Additionally, it looks like there's a risk of a double free because
kdst
is explicitly freed in a defer (https://github.com/diamondburned/gotk4/blob/pkg/v0.0.4/pkg/gtk/v4/gtkconstraintlayout.go#L399) but should also be freed when the hash table is deallocated.The text was updated successfully, but these errors were encountered: