Skip to content

Instantly share code, notes, and snippets.

@neguse
Created September 21, 2014 11:58
Show Gist options
  • Save neguse/142f683c799f2daad8c5 to your computer and use it in GitHub Desktop.
Save neguse/142f683c799f2daad8c5 to your computer and use it in GitHub Desktop.
This code causes segmentation fault on my machine( OS X 10.9.5, go1.3.1 darwin/amd64, sdl2-2.0.3 )
package main
import "github.com/veandco/go-sdl2/sdl"
func main() {
window := sdl.CreateWindow("test", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
800, 600, sdl.WINDOW_SHOWN)
surface := window.GetSurface()
rect := sdl.Rect{0, 0, 200, 200}
surface.FillRect(&rect, 0xffff0000)
go func() {
window.UpdateSurface()
}()
sdl.Delay(1000)
window.Destroy()
}
@neguse
Copy link
Author

neguse commented Sep 21, 2014

runtime.LockOSThread()していないのが原因だった
http://www.oki-osk.jp/esc/golang/cgo-osx.html#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment