apprt/gtk-ng: surface close in split tree

This commit is contained in:
Mitchell Hashimoto
2025-08-09 12:36:24 -07:00
parent a28d673467
commit 8232cf33b4
3 changed files with 62 additions and 30 deletions

View File

@@ -119,6 +119,9 @@ pub fn SplitTree(comptime V: type) type {
/// Clone this tree, returning a new tree with the same nodes.
pub fn clone(self: *const Self, gpa: Allocator) Allocator.Error!Self {
// If we're empty then return an empty tree.
if (self.isEmpty()) return .empty;
// Create a new arena allocator for the clone.
var arena = ArenaAllocator.init(gpa);
errdefer arena.deinit();