Skip to content

Commit 31a1c68

Browse files
committed
buffer: Don't Serialize in case the buffer is shared
Otherwise we unnecessarily serialize the shared buffer every time when closing a bufpane with this buffer, so every such serialize overwrites the previous one, thus only the last serialize (when closing the last instance of the buffer, i.e. when actually closing the file, i.e. when the buffer is not shared anymore) will be used anyway.
1 parent 6a9bf71 commit 31a1c68

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/buffer/buffer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,10 @@ func (b *Buffer) Close() {
532532
// Fini should be called when a buffer is closed and performs
533533
// some cleanup
534534
func (b *Buffer) Fini() {
535-
if !b.Modified() {
536-
b.Serialize()
537-
}
538535
if !b.Shared() {
536+
if !b.Modified() {
537+
b.Serialize()
538+
}
539539
b.CancelBackup()
540540
}
541541

0 commit comments

Comments
 (0)