diff options
| author | Jeff Carr <[email protected]> | 2025-03-10 04:37:42 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-10 04:37:42 -0500 |
| commit | 531a31e4b32421589341047629491adeea5d4b57 (patch) | |
| tree | 775537a7e4bc8ccab59bd4801d518011f32aa902 /action.go | |
| parent | 154c750e024adfb385f2fc134255ba70533285eb (diff) | |
quiet normal init() conditions
Diffstat (limited to 'action.go')
| -rw-r--r-- | action.go | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -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 } |
