mirror of
https://github.com/zyedidia/micro.git
synced 2024-09-11 04:05:38 +03:00
actions: Fix the iteration over a slice under modification in QuitAll() (#2898)
This commit is contained in:
parent
ceaa143c62
commit
a78c2c3509
@ -1582,9 +1582,7 @@ func (h *BufPane) QuitAll() bool {
|
||||
}
|
||||
|
||||
quit := func() {
|
||||
for _, b := range buffer.OpenBuffers {
|
||||
b.Close()
|
||||
}
|
||||
buffer.CloseOpenBuffers()
|
||||
screen.Screen.Fini()
|
||||
InfoBar.Close()
|
||||
runtime.Goexit()
|
||||
|
@ -430,6 +430,15 @@ func NewBuffer(r io.Reader, size int64, path string, startcursor Loc, btype BufT
|
||||
return b
|
||||
}
|
||||
|
||||
// CloseOpenBuffers removes all open buffers
|
||||
func CloseOpenBuffers() {
|
||||
for i, buf := range OpenBuffers {
|
||||
buf.Fini()
|
||||
OpenBuffers[i] = nil
|
||||
}
|
||||
OpenBuffers = OpenBuffers[:0]
|
||||
}
|
||||
|
||||
// Close removes this buffer from the list of open buffers
|
||||
func (b *Buffer) Close() {
|
||||
for i, buf := range OpenBuffers {
|
||||
|
Loading…
Reference in New Issue
Block a user