From 4e03b841a85f5c09898d34f45e6fcfb540050b42 Mon Sep 17 00:00:00 2001 From: Felix Angell Date: Sun, 6 May 2018 20:17:10 +0100 Subject: [PATCH] remove pprof stuff; avoid seg fault --- f | 0 foo | 0 gui/view.go | 5 ++++- main.go | 10 ---------- 4 files changed, 4 insertions(+), 11 deletions(-) create mode 100644 f create mode 100644 foo diff --git a/f b/f new file mode 100644 index 0000000..e69de29 diff --git a/foo b/foo new file mode 100644 index 0000000..e69de29 diff --git a/gui/view.go b/gui/view.go index 975aeac..5ac7fb5 100644 --- a/gui/view.go +++ b/gui/view.go @@ -111,7 +111,10 @@ func (n *View) ChangeFocus(dir int) { n.focusedBuff = 0 } - prevBuff.Buff.SetFocus(false) + if prevBuff != nil { + prevBuff.Buff.SetFocus(false) + } + if buffPane, ok := n.buffers[n.focusedBuff]; ok { buffPane.Buff.SetFocus(true) } diff --git a/main.go b/main.go index 4589d6c..f6fee36 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,6 @@ import ( "os" "path/filepath" "runtime" - "runtime/pprof" "time" "github.com/felixangell/phi/cfg" @@ -68,15 +67,6 @@ func (n *PhiEditor) render(ctx *strife.Renderer) { } func main() { - f, err := os.Create("cpu.prof") - if err != nil { - log.Fatal("could not create CPU profile: ", err) - } - if err := pprof.StartCPUProfile(f); err != nil { - log.Fatal("could not start CPU profile: ", err) - } - defer pprof.StopCPUProfile() - config := cfg.Setup() ww, wh := 1280, 720