Skip to content

Commit ddda4d0

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 f3ea704 commit ddda4d0

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

0 commit comments

Comments
 (0)