try to get toolkit to close
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f1b86c4e38
commit
3f2f3de751
|
@ -172,7 +172,7 @@ func addDebugKeys(g *gocui.Gui) {
|
||||||
// panic
|
// panic
|
||||||
g.SetKeybinding("", 'p', gocui.ModNone,
|
g.SetKeybinding("", 'p', gocui.ModNone,
|
||||||
func(g *gocui.Gui, v *gocui.View) error {
|
func(g *gocui.Gui, v *gocui.View) error {
|
||||||
standardExit()
|
standardClose()
|
||||||
panic("forced panic in gocui")
|
panic("forced panic in gocui")
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
20
main.go
20
main.go
|
@ -35,12 +35,6 @@ func init() {
|
||||||
log.Sleep(.1) // probably not needed, but in here for now under development
|
log.Sleep(.1) // probably not needed, but in here for now under development
|
||||||
}
|
}
|
||||||
|
|
||||||
func Exit() {
|
|
||||||
// TODO: what should actually happen here?
|
|
||||||
log.Log(NOW, "Exit() here. doing standardExit()")
|
|
||||||
standardExit()
|
|
||||||
}
|
|
||||||
|
|
||||||
func standardExit() {
|
func standardExit() {
|
||||||
log.Log(NOW, "standardExit() doing baseGui.Close()")
|
log.Log(NOW, "standardExit() doing baseGui.Close()")
|
||||||
me.baseGui.Close()
|
me.baseGui.Close()
|
||||||
|
@ -56,6 +50,17 @@ func standardExit() {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func standardClose() {
|
||||||
|
log.Log(NOW, "standardExit() doing baseGui.Close()")
|
||||||
|
me.baseGui.Close()
|
||||||
|
log.Log(NOW, "standardExit() doing outf.Close()")
|
||||||
|
outf.Close()
|
||||||
|
os.Stdin = os.Stdin
|
||||||
|
os.Stdout = os.Stdout
|
||||||
|
os.Stderr = os.Stderr
|
||||||
|
log.Log(NOW, "standardExit() send back Quit()")
|
||||||
|
}
|
||||||
|
|
||||||
var outf *os.File
|
var outf *os.File
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -66,9 +71,10 @@ func mainGogui() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
log.Warn("YAHOOOO Recovered in guiMain application:", r)
|
log.Warn("YAHOOOO Recovered in guiMain application:", r)
|
||||||
log.Warn("Recovered from panic:", r)
|
log.Warn("Recovered from panic:", r)
|
||||||
|
me.myTree.SendToolkitPanic()
|
||||||
log.Warn("Stack trace:")
|
log.Warn("Stack trace:")
|
||||||
debug.PrintStack()
|
debug.PrintStack()
|
||||||
me.myTree.SendToolkitPanic()
|
// panic("BUMMER")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -82,7 +82,7 @@ func action(a widget.Action) {
|
||||||
log.Log(NOW, "attempt to move() =", a.ActionType, a.WidgetType, a.ProgName)
|
log.Log(NOW, "attempt to move() =", a.ActionType, a.WidgetType, a.ProgName)
|
||||||
case widget.ToolkitClose:
|
case widget.ToolkitClose:
|
||||||
log.Log(NOW, "attempting to close the plugin and release stdout and stderr")
|
log.Log(NOW, "attempting to close the plugin and release stdout and stderr")
|
||||||
standardExit()
|
standardClose()
|
||||||
case widget.Enable:
|
case widget.Enable:
|
||||||
w.enable = true
|
w.enable = true
|
||||||
w.enableColor()
|
w.enableColor()
|
||||||
|
|
Loading…
Reference in New Issue