golang-ui / nuklear

This project provides Go bindings for nuklear.h — a small ANSI C GUI library.
https://github.com/vurtun/nuklear
MIT License
1.57k stars 98 forks source link

Example project crashes after X amount of seconds on Mac OSX #29

Closed aristotaloss closed 6 years ago

aristotaloss commented 6 years ago

Demo application cloned from https://github.com/golang-ui/nuklear/tree/master/cmd/nk-example crashes after a certain amount of seconds, sometimes immediately, sometimes after a minute.

Barts-MacBook-Pro:8bitmmo-updater bart$ ./8bitmmo-updater 
2017/09/26 16:20:42 glfw: created window 400x500
2017/09/26 16:20:44 [INFO] button pressed!
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xdf50340]

runtime stack:
runtime.throw(0x41ada04, 0x2a)
        /usr/local/Cellar/go/1.9/libexec/src/runtime/panic.go:605 +0x95
runtime.sigpanic()
        /usr/local/Cellar/go/1.9/libexec/src/runtime/signal_unix.go:351 +0x2b8

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x40ea040, 0xc420053b10, 0x100)
        /usr/local/Cellar/go/1.9/libexec/src/runtime/cgocall.go:132 +0xe4 fp=0xc420053ac8 sp=0xc420053a88 pc=0x4004a34
github.com/go-gl/gl/v3.2-core/gl._Cfunc_glowDrawElements(0x7fffaac1d5a7, 0x7800000004, 0x1403, 0x0)
        github.com/go-gl/gl/v3.2-core/gl/_obj/_cgo_gotypes.go:4057 +0x45 fp=0xc420053b10 sp=0xc420053ac8 pc=0x40ac785
github.com/go-gl/gl/v3.2-core/gl.DrawElements.func1(0x7fffaac1d5a7, 0x7800000004, 0xffffc3e800001403, 0x0)
        /Users/bart/go/src/github.com/go-gl/gl/v3.2-core/gl/package.go:5798 +0x82 fp=0xc420053b48 sp=0xc420053b10 pc=0x40c7332
github.com/go-gl/gl/v3.2-core/gl.DrawElements(0x7800000004, 0x800000001403, 0x0)
        /Users/bart/go/src/github.com/go-gl/gl/v3.2-core/gl/package.go:5798 +0x4f fp=0xc420053b78 sp=0xc420053b48 pc=0x40aec9f
github.com/golang-ui/nuklear/nk.NkPlatformRender.func1(0x500efe0)
        /Users/bart/go/src/github.com/golang-ui/nuklear/nk/impl_glfw_gl3.go:123 +0x129 fp=0xc420053bd0 sp=0xc420053b78 pc=0x40d6569
github.com/golang-ui/nuklear/nk.NkDrawForeach(0x503f800, 0x462bfb0, 0xc420053c78)
        /Users/bart/go/src/github.com/golang-ui/nuklear/nk/etc.go:90 +0x4f fp=0xc420053c08 sp=0xc420053bd0 pc=0x40d291f
github.com/golang-ui/nuklear/nk.NkPlatformRender(0x3e40c0c200000001, 0x80000, 0x20000)
        /Users/bart/go/src/github.com/golang-ui/nuklear/nk/impl_glfw_gl3.go:110 +0x4d0 fp=0xc420053d00 sp=0xc420053c08 pc=0x40d3e70
main.gfxMain(0xc4200b8000, 0x503f800, 0xc4200be0d0)
        /Users/bart/Documents/Projects/8bitmmo-updater/updater.go:147 +0x1bc fp=0xc420053d80 sp=0xc420053d00 pc=0x40e7aac
main.main()
        /Users/bart/Documents/Projects/8bitmmo-updater/updater.go:84 +0x6b5 fp=0xc420053f80 sp=0xc420053d80 pc=0x40e7785
runtime.main()
        /usr/local/Cellar/go/1.9/libexec/src/runtime/proc.go:185 +0x20d fp=0xc420053fe0 sp=0xc420053f80 pc=0x402c70d
runtime.goexit()
        /usr/local/Cellar/go/1.9/libexec/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc420053fe8 sp=0xc420053fe0 pc=0x4057a71

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
        /usr/local/Cellar/go/1.9/libexec/src/runtime/sigqueue.go:131 +0xa7
os/signal.loop()
        /usr/local/Cellar/go/1.9/libexec/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
        /usr/local/Cellar/go/1.9/libexec/src/os/signal/signal_unix.go:28 +0x41

goroutine 6 [select, locked to thread]:
runtime.gopark(0x41af320, 0x0, 0x41a453a, 0x6, 0x18, 0x1)
        /usr/local/Cellar/go/1.9/libexec/src/runtime/proc.go:277 +0x12c
runtime.selectgo(0xc42003ef50, 0xc42007a2a0)
        /usr/local/Cellar/go/1.9/libexec/src/runtime/select.go:395 +0x1138
runtime.ensureSigM.func1()
        /usr/local/Cellar/go/1.9/libexec/src/runtime/signal_unix.go:511 +0x1fe
runtime.goexit()
        /usr/local/Cellar/go/1.9/libexec/src/runtime/asm_amd64.s:2337 +0x1

goroutine 18 [select]:
github.com/xlab/closer.(*closer).wait(0xc420096000)
        /Users/bart/go/src/github.com/xlab/closer/closer.go:103 +0x163
created by github.com/xlab/closer.newCloser
        /Users/bart/go/src/github.com/xlab/closer/closer.go:95 +0x201

Not pressing any button or other interaction. System is running fine - enough memory, and have not experienced any issue similar to this before.

xlab commented 6 years ago

Hi, thanks for the report.

and have not experienced any issue similar to this before.

You mean using this package previously or the OS X system itself? I'm suspicious that this could be related to https://github.com/golang-ui/nuklear/issues/22, will investigate.

aristotaloss commented 6 years ago

Hi @xlab, I meant that I have not had that issue system-wide - I work with OpenGL quite frequently, and the same with Go, so I thought I'd let you know that I have a feeling it's related to nuklear instead of my machine :).

xlab commented 6 years ago

@Velocity- I've reproduced and it seems that a bit of changes added with #22 causes this. Please update the package, should be resolved for now. I will find the root cause later. :)