veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.21k stars 221 forks source link

Recent commit breaking use of render.Copy #422

Closed jackmott closed 5 years ago

jackmott commented 5 years ago

This commit seems to have broken copy on some of my existing programs: https://github.com/veandco/go-sdl2/commit/fbf6279185d95a1266b391df284c2db53a611649

renderer.Copy(tex, nil, nil) now panics with a nil pointer dereference error.

Per SDL2 specs this should be allowed: https://wiki.libsdl.org/SDL_RenderCopy

I'm not familiar with what was attempting to be fixed here with this change, so can't offer a fix, but am happy to help if anyone has pointers.

veeableful commented 5 years ago

Hi @jackmott, truly sorry about that! I should have fixed that in the test branch. Could I trouble you to go to $GOPATH/src/github.com/veandco/go-sdl2/sdl and run git fetch, git checkout test, git reset --hard origin/test, and finally go install? After that, you can try compiling your program again and see if it still happens. If everything's fine, I'll push to master branch immediately!

It was a workaround for a really strange problem where it affected audio playback by calling sdl.Renderer.Copy() using sdl.Rect from Go's context.

jackmott commented 5 years ago

Confirmed fixed, go ahead and push to master, thank you.

veeableful commented 5 years ago

Alright, I have pushed to master!