xthexder / go-jack

Go bindings for Jack Audio Connection Kit
MIT License
75 stars 21 forks source link

Segmentation fault when trying to run example/midipassthrough.go #13

Closed ugur-zongur closed 2 years ago

ugur-zongur commented 5 years ago

When I'm trying to run the midipassthrough.go example, I frequently get the following error especially when jackd period is set to small frame numbers e.g. -p128:

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9231c]

goroutine 17 [running, locked to thread]:
github.com/xthexder/go-jack.(*Port).GetMidiEvents(0x0, 0x100, 0x17284, 0x418130, 0x0)
        /home/chip/go/src/github.com/xthexder/go-jack/jack.go:361 +0x28
main.process(0x100, 0x442160)
        /home/chip/go/src/github.com/xthexder/go-jack/example/midipassthrough.go:15 +0x28
github.com/xthexder/go-jack.goProcess(0x100, 0x15e290, 0x4003c8)
        /home/chip/go/src/github.com/xthexder/go-jack/callbacks.go:19 +0x4c
github.com/xthexder/go-jack._cgoexpwrap_c157c22331d8_goProcess(0x100, 0x15e290, 0xb6f48e97)
        _cgo_gotypes.go:624 +0x24
exit status 2

I think it's because the client.SetProcessCallback(process) is called before the assignment of portIn is done.

xthexder commented 2 years ago

I've merged your PR, and fixed a similar issue in the other passthrough example. Unfortunately I've got no clue as to what's going on with the SuspendRefNum errors either.