mmp / vice

Virtual air traffic control simulator
https://pharr.org/vice
GNU General Public License v3.0
18 stars 25 forks source link

Crash when clicking messages font picker #236

Closed jlefkoff closed 1 month ago

jlefkoff commented 1 month ago

Vice crashes when you click on the font dropdown in the "messages" section of the settings menu. M2 Mac Sonoma 14.0, crash below.

2024/06/01 14:04:49 ERROR Caught panic! callstack="[{File:main.go Line:212 Function:main.func5} {File:panic.go Line:770 Function:runtime.gopanic} {File:panic.go Line:261 Function:runtime.panicmem} {File:signal_unix.go Line:881 Function:runtime.sigpanic} {File:fonts.go Line:339 Function:DrawFontPicker} {File:panes.go Line:843 Function:(*MessagesPane).DrawUI} {File:world.go Line:1725 Function:(*World).DrawSettingsWindow} {File:ui.go Line:416 Function:drawUI} {File:main.go Line:408 Function:main}]" stack="goroutine 1 [running, locked to thread]:\nruntime/debug.Stack()\n\t/opt/homebrew/Cellar/go/1.22.3/libexec/src/runtime/debug/stack.go:24 +0x64\nmain.main.func5()\n\t/Users/jonah/Documents/GitHub/vice/main.go:212 +0x48\npanic({0x100e97140?, 0x1014abe60?})\n\t/opt/homebrew/Cellar/go/1.22.3/libexec/src/runtime/panic.go:770 +0x124\nmain.DrawFontPicker(0x140049b9c20, {0x100c56d5a, 0x4})\n\t/Users/jonah/Documents/GitHub/vice/fonts.go:339 +0x1c4\nmain.(*MessagesPane).DrawUI(...)\n\t/Users/jonah/Documents/GitHub/vice/panes.go:843\nmain.(*World).DrawSettingsWindow(0x140119ae388)\n\t/Users/jonah/Documents/GitHub/vice/world.go:1725 +0x4c0\nmain.drawUI({0x100f8cc90, 0x1400329cf00}, {0x100f892d0, 0x1400ebf4000}, 0x140119ae388, 0x140003c0f80, 0x14002871b40)\n\t/Users/jonah/Documents/GitHub/vice/ui.go:416 +0x938\nmain.main()\n\t/Users/jonah/Documents/GitHub/vice/main.go:408 +0x19c4\n"
2024/06/01 14:04:49 ERROR Unfortunately an unexpected error has occurred and vice is unable to recover.
Apologies! Please do file a bug and include the vice.log file for this session
so that this bug can be fixed.

Error: runtime error: invalid memory address or nil pointer dereference callstack="[{File:ui.go Line:1372 Function:ShowFatalErrorDialog} {File:main.go Line:213 Function:main.func5} {File:panic.go Line:770 Function:runtime.gopanic} {File:panic.go Line:261 Function:runtime.panicmem} {File:signal_unix.go Line:881 Function:runtime.sigpanic} {File:fonts.go Line:339 Function:DrawFontPicker} {File:panes.go Line:843 Function:(*MessagesPane).DrawUI} {File:world.go Line:1725 Function:(*World).DrawSettingsWindow} {File:ui.go Line:416 Function:drawUI} {File:main.go Line:408 Function:main}]"
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: Assertion failed!
File: /Users/jonah/go/pkg/mod/github.com/mmp/imgui-go/v4@v4.0.0-20220911181801-968a517f674f/imgui/imgui.cpp, Line 7263

Expression: (g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?"

[signal SIGSEGV: segmentation violation code=0x2 addr=0x418 pc=0x100b518b4]

goroutine 1 [running, locked to thread]:
github.com/mmp/imgui-go/v4.init.func2({0x140007fc630?, 0x1004ced60?}, {0x14001c04540?, 0x1004659bc?}, 0x14002870fd8?)
        /Users/jonah/go/pkg/mod/github.com/mmp/imgui-go/v4@v4.0.0-20220911181801-968a517f674f/Assert.go:28 +0x60
github.com/mmp/imgui-go/v4.iggAssert(0x14002871018?, 0x100dc677d, 0x21c0?)
        /Users/jonah/go/pkg/mod/github.com/mmp/imgui-go/v4@v4.0.0-20220911181801-968a517f674f/Assert.go:45 +0x74
github.com/mmp/imgui-go/v4._Cfunc_iggNewFrame()
        _cgo_gotypes.go:4269 +0x30
github.com/mmp/imgui-go/v4.NewFrame(...)
        /Users/jonah/go/pkg/mod/github.com/mmp/imgui-go/v4@v4.0.0-20220911181801-968a517f674f/Main.go:18
main.ShowFatalErrorDialog({0x100f892d0, 0x1400ebf4000}, {0x100f8cc90, 0x1400329cf00}, {0x100ca943c, 0xc6}, {0x14002871338, 0x1, 0x1})
        /Users/jonah/Documents/GitHub/vice/ui.go:1379 +0x130
main.main.func5()
        /Users/jonah/Documents/GitHub/vice/main.go:213 +0x12c
panic({0x100e97140?, 0x1014abe60?})
        /opt/homebrew/Cellar/go/1.22.3/libexec/src/runtime/panic.go:770 +0x124
main.DrawFontPicker(0x140049b9c20, {0x100c56d5a, 0x4})
        /Users/jonah/Documents/GitHub/vice/fonts.go:339 +0x1c4
main.(*MessagesPane).DrawUI(...)
        /Users/jonah/Documents/GitHub/vice/panes.go:843
main.(*World).DrawSettingsWindow(0x140119ae388)
        /Users/jonah/Documents/GitHub/vice/world.go:1725 +0x4c0
main.drawUI({0x100f8cc90, 0x1400329cf00}, {0x100f892d0, 0x1400ebf4000}, 0x140119ae388, 0x140003c0f80, 0x14002871b40)
        /Users/jonah/Documents/GitHub/vice/ui.go:416 +0x938
main.main()
        /Users/jonah/Documents/GitHub/vice/main.go:408 +0x19c4
mmp commented 1 month ago

Yikes! Thanks for reporting this. Fixed for the next release.