gtk: refactor the Paned deinit method

This commit is contained in:
Thorsten Ball
2023-10-27 06:56:31 +02:00
committed by Mitchell Hashimoto
parent adba77c3f9
commit 34e4261210

View File

@ -220,19 +220,13 @@ fn surfaceInPosition(self: *Paned, position: Position) ?*Surface {
}
pub fn deinit(self: *Paned, alloc: Allocator) void {
switch (self.child1) {
.none, .surface => {},
.paned => |paned| {
paned.deinit(alloc);
alloc.destroy(paned);
},
}
switch (self.child2) {
.none, .surface => {},
.paned => |paned| {
paned.deinit(alloc);
alloc.destroy(paned);
},
for ([_]Child{ self.child1, self.child2 }) |child| {
switch (child) {
.none, .surface => continue,
.paned => |paned| {
paned.deinit(alloc);
alloc.destroy(paned);
},
}
}
}