summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addNode.go2
-rw-r--r--init.go7
-rw-r--r--structs.go14
3 files changed, 15 insertions, 8 deletions
diff --git a/addNode.go b/addNode.go
index 43e4d20..e0af110 100644
--- a/addNode.go
+++ b/addNode.go
@@ -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)
}
diff --git a/init.go b/init.go
index 9a9101b..9212f00 100644
--- a/init.go
+++ b/init.go
@@ -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()
}
}()
diff --git a/structs.go b/structs.go
index 679bdb2..367f21a 100644
--- a/structs.go
+++ b/structs.go
@@ -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()
}