Skip to content

Commit

Permalink
internal/ui: refactoring: call initOnMainThread on the main thread ex…
Browse files Browse the repository at this point in the history
…plicitly

Closes #3042
  • Loading branch information
hajimehoshi committed Jul 15, 2024
1 parent d4dc2ef commit 3d385ef
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions internal/ui/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ func (u *UserInterface) runMultiThread(game Game, options *RunOptions) error {

u.context = newContext(game)

if err := u.initOnMainThread(options); err != nil {
return err
}

ctx, cancel := stdcontext.WithCancel(stdcontext.Background())
defer cancel()

Expand All @@ -64,6 +60,17 @@ func (u *UserInterface) runMultiThread(game Game, options *RunOptions) error {
// Run the game thread.
wg.Go(func() error {
defer cancel()

var err error
u.mainThread.Call(func() {
if err1 := u.initOnMainThread(options); err1 != nil {
err = err1
}
})
if err != nil {
return err
}

return u.loopGame()
})

Expand Down

1 comment on commit 3d385ef

@hajimehoshi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closes #3042

This is typo. This just updates #3042

Please sign in to comment.