Never backup closed buffers

This commit is contained in:
Zachary Yedidia
2020-09-04 13:36:23 -04:00
parent 04c1430747
commit f35f507832
2 changed files with 9 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import (
"io"
"os"
"path/filepath"
"sync/atomic"
"time"
"github.com/zyedidia/micro/v2/internal/config"
@@ -36,7 +37,10 @@ func backupThread() {
for len(backupRequestChan) > 0 {
b := <-backupRequestChan
b.Backup()
bfini := atomic.LoadInt32(&(b.fini)) != 0
if !bfini {
b.Backup()
}
}
}
}