Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
sergystepanov committed Oct 20, 2023
1 parent e983e79 commit 23f55f2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/worker/caged/libretro/graphics/sdl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"unsafe"

"github.com/giongto35/cloud-game/v3/pkg/logger"
"github.com/giongto35/cloud-game/v3/pkg/worker/thread"
"github.com/veandco/go-sdl2/sdl"
)

Expand Down Expand Up @@ -60,7 +61,7 @@ func NewSDLContext(cfg Config, log *logger.Logger) (*SDL, error) {

var err error
// In OSX 10.14+ window creation and context creation must happen in the main thread
display.w, display.glWCtx, err = createWindow()
thread.Main(func() { display.w, display.glWCtx, err = createWindow() })
if err != nil {
return nil, fmt.Errorf("window fail: %w", err)
}
Expand All @@ -80,9 +81,11 @@ func NewSDLContext(cfg Config, log *logger.Logger) (*SDL, error) {
func (s *SDL) Deinit() error {
s.log.Debug().Msg("[SDL/OpenGL] shutdown...")
destroyFramebuffer()

var err error
// In OSX 10.14+ window deletion must happen in the main thread
err := s.destroyWindow()
thread.Main(func() {
err = s.destroyWindow()
})
if err != nil {
return fmt.Errorf("[SDL/OpenGL] deinit fail: %w", err)
}
Expand Down

0 comments on commit 23f55f2

Please sign in to comment.