dialog: GTK3 segmentation fault (fedora)
Hi, thanks for your work !
I’m running into a weird issue, I’m writing a gui application and when I click my button to open the file dialog it segfault. The thing that is very weird is that if at the start of my application (before running the main loop) i’m opening a file dialog it does it successfully and my button works after that (looks like gtk needs a warm up 😄 )
My call looks like that: tscw.newPath, _ = dialog.File().Load()
Here is the stacktrace:
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7f2d123ced74]
runtime stack:
runtime.throw(0x97b720, 0x2a)
/usr/lib/golang/src/runtime/panic.go:1116 +0x72
runtime.sigpanic()
/usr/lib/golang/src/runtime/signal_unix.go:679 +0x46a
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x867f10, 0xc000129930, 0x3962400)
/usr/lib/golang/src/runtime/cgocall.go:133 +0x5b fp=0xc000129900 sp=0xc0001298c8 pc=0x49c38b
github.com/gotk3/gotk3/gtk._Cfunc_gtk_dialog_run(0x3962400, 0x0)
_cgo_gotypes.go:8410 +0x49 fp=0xc000129930 sp=0xc000129900 pc=0x5d2119
github.com/gotk3/gotk3/gtk.(*Dialog).Run.func1(0xc00017f9b0, 0xc00017f901)
/home/hfabre/go/pkg/mod/github.com/gotk3/gotk3@v0.4.0/gtk/gtk.go:2963 +0x5b fp=0xc000129968 sp=0xc000129930 pc=0x66c1bb
github.com/gotk3/gotk3/gtk.(*Dialog).Run(0xc00017f9b0, 0x1)
/home/hfabre/go/pkg/mod/github.com/gotk3/gotk3@v0.4.0/gtk/gtk.go:2963 +0x2b fp=0xc000129988 sp=0xc000129968 pc=0x6238db
github.com/sqweek/dialog.chooseFile(0x974039, 0x9, 0x97362c, 0x4, 0x0, 0xc000129ba8, 0x0, 0x0, 0x0, 0x0)
/home/hfabre/go/pkg/mod/github.com/sqweek/dialog@v0.0.0-20200601143742-43ea34326190/dlgs_linux.go:79 +0x37c fp=0xc000129af8 sp=0xc000129988 pc=0x7a002c
github.com/sqweek/dialog.(*FileBuilder).load(...)
/home/hfabre/go/pkg/mod/github.com/sqweek/dialog@v0.0.0-20200601143742-43ea34326190/dlgs_linux.go:45
github.com/sqweek/dialog.(*FileBuilder).Load(0xc000129ba8, 0x41c8000042960000, 0x975033, 0xe, 0x101)
/home/hfabre/go/pkg/mod/github.com/sqweek/dialog@v0.0.0-20200601143742-43ea34326190/dlgs.go:112 +0x62 fp=0xc000129b58 sp=0xc000129af8 pc=0x79fb12
ttme/src.(*tilesetConfigurationWidget).Draw(0xc000129df0)
/home/hfabre/local/go/ttme/src/tleset_configuration_widget.go:27 +0x341 fp=0xc000129bf0 sp=0xc000129b58 pc=0x7a3501
ttme/src.(*app).Start(0xc000074480)
/home/hfabre/local/go/ttme/src/app.go:71 +0x326 fp=0xc000129f50 sp=0xc000129bf0 pc=0x7a08a6
main.main()
/home/hfabre/local/go/ttme/main.go:9 +0x56 fp=0xc000129f88 sp=0xc000129f50 pc=0x7a46a6
runtime.main()
/usr/lib/golang/src/runtime/proc.go:203 +0x1fa fp=0xc000129fe0 sp=0xc000129f88 pc=0x4cd06a
runtime.goexit()
/usr/lib/golang/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000129fe8 sp=0xc000129fe0 pc=0x4f7af1
exit status 2
make: *** [Makefile:4: run] Error 1
I feel like it’s not very clear, ping me if you don’t understand
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 26 (10 by maintainers)
Thanks @Ziemas! I’m confused as to why pthread_mutex_lock() or similar doesn’t show up in the backtrace, but I’ve committed a fix based on your suggestion (after another user tested it in #58).
Optimistically closing this.
I think I ran into this on the OpenDiablo2 fork as well. What I found was that it crashes because a null ptr gets passed to
pthread_mutex_lock()somewhere in libX11.I’m able to get it working by calling
XInitThreads()beforegtk_init(), not really sure if that is a completely proper solution though.