still doesn't trap panic

This commit is contained in:
Jeff Carr 2025-09-05 01:24:41 -05:00
parent 9b1e7f102e
commit 25a074d02d
1 changed files with 14 additions and 0 deletions

14
init.go
View File

@ -4,6 +4,7 @@ package main
import (
"runtime/debug"
"sync"
"time"
"go.wit.com/log"
"go.wit.com/toolkits/tree"
@ -123,10 +124,23 @@ func guiMain() {
return
}
}()
// TODO: THIS IS THE PROBLEM
ui.Main(func() {
// this is a bad hack for now.
// a better way would be to spawn ui.Main on the first actual window
// that is supposed to be displayed
if r := recover(); r != nil {
log.Log(WARN, "YAHOO andlabs GUI recovered in guiMain()")
log.Log(WARN, "Stack trace:")
debug.PrintStack()
log.Log(WARN, "Recovered from panic:", r)
log.Log(WARN, "andlabs GUI recovered in guiMain()")
log.Log(WARN, "YAHOO andlabs GUI recovered in guiMain()")
me.myTree.SendToolkitPanic()
return
}
time.Sleep(time.Second)
placeholderUI()
me.myTree.InitOK()