aboutsummaryrefslogtreecommitdiff
path: root/src/output.zig
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-04-18 12:21:43 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-04-18 12:21:43 +0200
commitcd19a4615b822ab85ebe1430ec956f6b22f3d008 (patch)
treec3b9cd94870ecb8e37c5ca9d29cd1077c7820bef /src/output.zig
parented7aca261bc51790334a0adc9e00df5eda6dbc83 (diff)
downloadriver-cd19a4615b822ab85ebe1430ec956f6b22f3d008.tar.gz
river-cd19a4615b822ab85ebe1430ec956f6b22f3d008.tar.xz
Properly clean up resources on exit
Diffstat (limited to 'src/output.zig')
-rw-r--r--src/output.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/output.zig b/src/output.zig
index e951fe3..bb88156 100644
--- a/src/output.zig
+++ b/src/output.zig
@@ -101,6 +101,20 @@ pub const Output = struct {
}
}
+ pub fn deinit(self: *Self) void {
+ for (self.layers) |*layer| {
+ while (layer.pop()) |layer_surface_node| {
+ self.root.server.allocator.destroy(layer_surface_node);
+ }
+ }
+
+ while (self.views.first) |node| {
+ node.view.deinit();
+ self.views.remove(node);
+ self.root.server.allocator.destroy(node);
+ }
+ }
+
/// Add a new view to the output. arrangeViews() will be called by the view
/// when it is mapped.
pub fn addView(self: *Self, wlr_xdg_surface: *c.wlr_xdg_surface) void {