quiet normal init() conditions

This commit is contained in:
Jeff Carr 2025-03-10 04:37:42 -05:00
parent 154c750e02
commit 531a31e4b3
2 changed files with 14 additions and 8 deletions

View File

@ -13,17 +13,18 @@ import (
// everything from the application goes through here
func (me *TreeInfo) doAction(a widget.Action) {
if a.ActionType == widget.ToolkitInit {
log.Log(TREEWARN, "tree.doAction() trapped ToolkitInit finally!")
log.Log(TREE, "tree.doAction() trapped ToolkitInit finally!")
a.WidgetType = widget.Root
n := addNode(&a)
me.Add(n)
log.Log(TREEWARN, "tree.doAction() init() me.treeRoot")
if me.ToolkitInit != nil {
log.Log(TREEWARN, "tree.doAction() doing ToolkitInit()")
me.ToolkitInit()
} else {
log.Log(TREEWARN, "tree.doAction() me.ToolkitInit() == nil")
log.Log(TREE, "tree.doAction() init() me.treeRoot")
if me.ToolkitInit == nil {
log.Log(TREE, "tree.doAction() ToolkitInit() was called before plugin had a chance to initialize")
log.Log(TREE, "tree.doAction() TODO: fix channel to pause")
return
}
log.Log(TREE, "tree.doAction() doing ToolkitInit()")
me.ToolkitInit()
return
}
if a.TablePB != nil {
@ -44,6 +45,11 @@ func (me *TreeInfo) doAction(a widget.Action) {
me.Add(n)
return
}
if a.WidgetId == 0 {
// this is ok. This is the binary tree base and it's already initialized. This happens on startup
return
}
// this shouldn't really happen. It's good to print a warning so the plugin code can be debugged
log.Log(TREEWARN, "attempting to re-add widget", a.WidgetId, a.WidgetType, a.ActionType)
return
}

View File

@ -9,7 +9,7 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node {
if me.TryLock() {
defer me.Unlock()
} else {
log.Info("TREE: mutex lock was already held before AddNode()")
log.Log(TREE, "mutex lock was already held before AddNode()")
}
return addNode(a)
}