mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
fix a couple memory leaks
This commit is contained in:
@ -374,6 +374,12 @@ pub fn eraseDisplay(
|
|||||||
cell.char = 0;
|
cell.char = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remaining lines are deallocated
|
||||||
|
if (self.cursor.y + 1 < self.screen.items.len) {
|
||||||
|
for (self.screen.items[self.cursor.y + 1 .. self.screen.items.len]) |*below|
|
||||||
|
below.deinit(alloc);
|
||||||
|
}
|
||||||
|
|
||||||
// Shrink
|
// Shrink
|
||||||
self.screen.shrinkRetainingCapacity(self.cursor.y + 1);
|
self.screen.shrinkRetainingCapacity(self.cursor.y + 1);
|
||||||
},
|
},
|
||||||
@ -555,6 +561,10 @@ pub fn scrollDown(self: *Terminal, alloc: Allocator) !void {
|
|||||||
// Add one more item if we aren't at the max
|
// Add one more item if we aren't at the max
|
||||||
if (self.screen.items.len < self.rows) {
|
if (self.screen.items.len < self.rows) {
|
||||||
self.screen.items.len += 1;
|
self.screen.items.len += 1;
|
||||||
|
} else {
|
||||||
|
// We have the max, we need to deinitialize the last row because
|
||||||
|
// we're going to overwrite it.
|
||||||
|
self.screen.items[self.screen.items.len - 1].deinit(alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shift everything down
|
// Shift everything down
|
||||||
|
Reference in New Issue
Block a user