fix crash

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-29 10:49:29 -07:00
parent 7107b534bc
commit 639d636769
2 changed files with 15 additions and 3 deletions

17
area.go
View File

@ -24,13 +24,13 @@ func makeSplashArea() *AreaHandler {
// make this button just to get the default font (but don't display the button) // make this button just to get the default font (but don't display the button)
// There should be another way to do this (?) // There should be another way to do this (?)
newB := CreateFontButton("AREA") newB := CreateFontButton("AREA")
myAH.FontButton = newB.FB
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
tmp := findFB(newB) tmp := findFB(newB)
log.Println("makeSplashArea() newB =", newB) log.Println("makeSplashArea() newB =", newB)
log.Println("makeSplashArea() newB.AH =", newB.AH) log.Println("makeSplashArea() newB.AH =", newB.AH)
log.Println("makeSplashArea() newB =", newB) log.Println("makeSplashArea() newB =", newB)
newB.AH = &myAH
// log.Println("makeSplashArea() newB.AH =", newB.AH) // log.Println("makeSplashArea() newB.AH =", newB.AH)
log.Println("makeSplashArea() newB =", newB) log.Println("makeSplashArea() newB =", newB)
@ -38,11 +38,22 @@ func makeSplashArea() *AreaHandler {
tmp = findFB(newB) tmp = findFB(newB)
log.Println("makeSplashArea() tmp =", tmp, "newB", newB) log.Println("makeSplashArea() tmp =", tmp, "newB", newB)
Data.AllButtons[1].AH = &myAH
time.Sleep(200 * time.Millisecond)
tmp = findFB(newB)
log.Println("makeSplashArea() tmp =", tmp, "newB", newB)
// log.Println("makeSplashArea() ah =", myAH)
log.Println("makeSplashArea() ah.FontButton =", myAH.FontButton)
// DefaultFont: ah.FontButton.Font(),
myAH.Attrstr = makeAttributedString() myAH.Attrstr = makeAttributedString()
myAH.Area = ui.NewArea(myAH) myAH.Area = ui.NewArea(myAH)
newB.A = myAH.Area newB.A = myAH.Area
myAH.FontButton = newB.FB Data.AllButtons[1].A = myAH.Area
myAH.Button = newB myAH.FontButton = Data.AllButtons[1].FB
myAH.Button = &Data.AllButtons[1]
if (Data.Debug) { if (Data.Debug) {
spew.Dump(myAH.Area) spew.Dump(myAH.Area)

1
gui.go
View File

@ -232,6 +232,7 @@ func CreateFontButton(action string) *ButtonMap {
var newBM ButtonMap var newBM ButtonMap
newBM.Action = action newBM.Action = action
newBM.FB = newB newBM.FB = newB
newBM.AH = &myAH
Data.AllButtons = append(Data.AllButtons, newBM) Data.AllButtons = append(Data.AllButtons, newBM)
newB.OnChanged(func (*ui.FontButton) { newB.OnChanged(func (*ui.FontButton) {