From 53c09be846dfa3b05288208f5e25ce4328d3a855 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 20 Feb 2024 22:57:59 +0100 Subject: [PATCH] Root: fix crash on deinit() --- river/Root.zig | 1 - river/Server.zig | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/river/Root.zig b/river/Root.zig index 7399408..dcce9c7 100644 --- a/river/Root.zig +++ b/river/Root.zig @@ -192,7 +192,6 @@ pub fn init(self: *Self) !void { } pub fn deinit(self: *Self) void { - self.scene.tree.node.destroy(); self.output_layout.destroy(); self.transaction_timeout.remove(); } diff --git a/river/Server.zig b/river/Server.zig index 073de61..0c93dd3 100644 --- a/river/Server.zig +++ b/river/Server.zig @@ -190,6 +190,12 @@ pub fn deinit(self: *Self) void { self.wl_server.destroyClients(); self.backend.destroy(); + + // The scene graph needs to be destroyed after the backend but before the renderer + // Output destruction requires the scene graph to still be around while the scene + // graph may require the renderer to still be around to destroy textures it seems. + self.root.scene.tree.node.destroy(); + self.renderer.destroy(); self.allocator.destroy();