aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--river/Output.zig8
-rw-r--r--river/OutputManager.zig7
2 files changed, 15 insertions, 0 deletions
diff --git a/river/Output.zig b/river/Output.zig
index 155ce62..7e24008 100644
--- a/river/Output.zig
+++ b/river/Output.zig
@@ -513,6 +513,14 @@ fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
root.removeOutput(node);
}
+ var it = root.all_outputs.first;
+ while (it) |all_node| : (it = all_node.next) {
+ if (all_node.data == self) {
+ root.all_outputs.remove(all_node);
+ break;
+ }
+ }
+
// Remove all listeners
c.wl_list_remove(&self.listen_destroy.link);
c.wl_list_remove(&self.listen_frame.link);
diff --git a/river/OutputManager.zig b/river/OutputManager.zig
index 4415352..208a2e6 100644
--- a/river/OutputManager.zig
+++ b/river/OutputManager.zig
@@ -66,7 +66,14 @@ fn handleNewOutput(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void
c.wlr_output_destroy(wlr_output);
return;
};
+ const ptr_node = util.gpa.create(std.TailQueue(*Output).Node) catch {
+ util.gpa.destroy(node);
+ c.wlr_output_destroy(wlr_output);
+ return;
+ };
+ ptr_node.data = &node.data;
+ self.root.all_outputs.append(ptr_node);
self.root.addOutput(node);
}