Skip to content

ebiten: crash when leaving an app on macOS #3241

@hajimehoshi

Description

@hajimehoshi

Ebitengine Version

cd31850

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

Go Version (go version)

go version go1.24.3 darwin/arm64

What steps will reproduce the problem?

I am not sure the reproducible way. I think this happened by leaving the app and closing the laptop.

What is the expected result?

No crash

What happens instead?

ERROR runtime error: invalid memory address or nil pointer dereference                                                                                              
goroutine 1 [running, locked to thread]:                                                                                                                                                
runtime/debug.Stack()                                                                                                                                                                   
        /usr/local/go/src/runtime/debug/stack.go:26 +0x64                                                                                                                               
****.logErrorAndExit({0x103368380, 0x105064cc0}, 0x1400b647bf0)                                                                      
        ****/log.go:135 +0x28                                                                                                          
****.func1()                                                                                                                     
        ****/log.go:220 +0x38                                                                                                          
panic({0x103368380?, 0x105064cc0?})                                                                                                                                                     
        /usr/local/go/src/runtime/panic.go:792 +0x124                                                                                                                                   
github.com/hajimehoshi/ebiten/v2/internal/ui.(*Monitor).DeviceScaleFactor(...)                                                                                                          
        /Users/hajimehoshi/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.9.0-alpha.5.0.20250518103147-cd31850015bb/internal/ui/monitor_glfw.go:45                                      
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).outsideSize(0x14000034f08)
        /Users/hajimehoshi/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.9.0-alpha.5.0.20250518103147-cd31850015bb/internal/ui/ui_glfw.go:1249 +0x114
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).update(0x14000034f08)
        /Users/hajimehoshi/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.9.0-alpha.5.0.20250518103147-cd31850015bb/internal/ui/ui_glfw.go:1435 +0x334
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).updateGame.func1()
        /Users/hajimehoshi/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.9.0-alpha.5.0.20250518103147-cd31850015bb/internal/ui/ui_glfw.go:1480 +0x44
github.com/hajimehoshi/ebiten/v2/internal/thread.(*OSThread).Loop.func1({0x140149ace70?, 0xb0?}, 0x1400b647c00?)
        /Users/hajimehoshi/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.9.0-alpha.5.0.20250518103147-cd31850015bb/internal/thread/thread.go:67 +0x58
github.com/hajimehoshi/ebiten/v2/internal/thread.(*OSThread).Loop(0x1400b647c00, {0x1034e3940, 0x140005b2e10})
        /Users/hajimehoshi/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.9.0-alpha.5.0.20250518103147-cd31850015bb/internal/thread/thread.go:68 +0x60
...
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).runMultiThread(0x14000034f08, {0x1034e8a10, 0x1400048f880}, 0x140005b27d0)
        /Users/hajimehoshi/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.9.0-alpha.5.0.20250518103147-cd31850015bb/internal/ui/run.go:94 +0x344
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).Run(0x140005c1380?, {0x1034e8a10?, 0x1400048f880?}, 0x102bbe6c0?)
        /Users/hajimehoshi/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.9.0-alpha.5.0.20250518103147-cd31850015bb/internal/ui/run.go:35 +0x3c

Anything else you feel useful to add?

                     ..'          hajimehoshi@Hajimes-MacBook-Pro
                 ,xNMM.           -------------------------------
               .OMMMMo            OS: macOS Sequoia 15.4.1 arm64
               lMM"               Host: MacBook Pro (14-inch, Nov 2023, Three Thunderbolt 4 ports)
     .;loddo:.  .olloddol;.       Kernel: Darwin 24.4.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:     Uptime: 13 days, 10 hours, 9 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.     Packages: 146 (brew), 3 (brew-cask)
 XMMMMMMMMMMMMMMMMMMMMMMMX.       Shell: zsh 5.9
;MMMMMMMMMMMMMMMMMMMMMMMM:        Display (Color LCD): 3600x2338 @ 120 Hz (as 1800x1169) in 14" [Built-in]
:MMMMMMMMMMMMMMMMMMMMMMMM:        DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.       WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.     WM Theme: Multicolor (Light)
 'XMMMMMMMMMMMMMMMMMMMMMMMMMMk    Font: .AppleSystemUIFont [System], Helvetica [User]
  'XMMMMMMMMMMMMMMMMMMMMMMMMK.    Cursor: Fill - Black, Outline - White (32px)
    kMMMMMMMMMMMMMMMMMMMMMMd      Terminal: tmux 3.5a
     ;KMMMMMMMWXXWMMMMMMMk.       CPU: Apple M3 Pro (12) @ 4.06 GHz
       "cooc*"    "*coo'"         GPU: Apple M3 Pro (18) @ 1.38 GHz [Integrated]
                                  Memory: 15.65 GiB / 18.00 GiB (87%)
                                  Swap: 30.09 GiB / 31.00 GiB (97%)
                                  Disk (/): 472.52 GiB / 926.35 GiB (51%) - apfs [Read-only]
                                  Local IP (en0): 192.168.0.13/24
                                  Battery (bq40z651): 80% [AC connected]
                                  Power Adapter: 96W USB-C Power Adapter
                                  Locale: en_US.UTF-8

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions