mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-20 14:21:00 +00:00
backup: Lock the buffer lines in Backup()
This commit is contained in:
parent
0b871e174f
commit
42ae05b082
1 changed files with 3 additions and 0 deletions
|
|
@ -82,6 +82,9 @@ func (b *Buffer) Backup() error {
|
|||
name := filepath.Join(backupdir, util.EscapePath(b.AbsPath))
|
||||
|
||||
err = overwriteFile(name, encoding.Nop, func(file io.Writer) (e error) {
|
||||
b.Lock()
|
||||
defer b.Unlock()
|
||||
|
||||
if len(b.lines) == 0 {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue