Skip to content

Commit e323cde

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 ef57bdc commit e323cde

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
@@ -524,10 +524,10 @@ func (b *Buffer) Close() {
524524
// Fini should be called when a buffer is closed and performs
525525
// some cleanup
526526
func (b *Buffer) Fini() {
527-
if !b.Modified() {
528-
b.Serialize()
529-
}
530527
if !b.Shared() {
528+
if !b.Modified() {
529+
b.Serialize()
530+
}
531531
b.CancelBackup()
532532
}
533533

0 commit comments

Comments
 (0)