gocui panic loads nocui

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-09 09:30:50 -06:00
parent bd24754c82
commit 0f9b7ec2af
3 changed files with 15 additions and 8 deletions

View File

@ -16,7 +16,7 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node {
// n.Strings = make(map[string]int)
// slices.Reverse(lines)
// dropdown strings
n.ddStrings = make([]string, 0)
n.ddStrings = make([]string, 0)
for _, s := range a.State.Strings {
n.ddStrings = append(n.ddStrings, s)
}

View File

@ -2,6 +2,7 @@ package tree
import (
"errors"
"runtime/debug"
"sync"
"go.wit.com/log"
@ -13,6 +14,11 @@ var muAction sync.Mutex
// TODO: add checks for nil function pointers
func (me *TreeInfo) newAction(a widget.Action) {
n := me.treeRoot.FindWidgetId(a.WidgetId)
if n == nil {
log.Log(TREEWARN, "tree.FindWidgetId() n == nil", a.WidgetId, a.WidgetType, a.ActionType)
log.Log(TREEWARN, "tree.FindWidgetId() n == nil", a.State.CurrentS)
log.Log(TREEWARN, "tree.FindWidgetId() n == nil. This should not happen. Bug in gui or tree package?")
}
switch a.ActionType {
case widget.Add:
if n == nil {
@ -70,6 +76,7 @@ func (me *TreeInfo) catchActionChannel() {
log.Log(TREEWARN, "YAHOOOO Recovered in tree.catchActionChannel()", r)
log.Log(TREEWARN, "YAHOOOO Recovered in tree.catchActionChannel() Plugin:", me.PluginName)
me.SendToolkitPanic()
debug.PrintStack()
me.ToolkitClose()
}
}()

View File

@ -24,13 +24,13 @@ type TreeInfo struct {
// NodeI interface{}
// ActionFromChannel func(widget.Action)
NodeAction func(*Node, widget.ActionType)
Add func(*Node)
AddText func(*Node, string)
SetText func(*Node, string)
SetTitle func(*Node, string)
SetLabel func(*Node, string)
SetChecked func(*Node, bool)
NodeAction func(*Node, widget.ActionType)
Add func(*Node)
AddText func(*Node, string)
SetText func(*Node, string)
SetTitle func(*Node, string)
SetLabel func(*Node, string)
SetChecked func(*Node, bool)
ToolkitClose func()
}