git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commita5c8c40297fb0d63f1051c7f9e08cad2cfacb1c0
parent91dbd40ac7
authorSivecano <[email protected]>
date2026-03-13 22:45
WindowManager: handle destroy during manage/render sequence

The river_window_manager_v1 object might be destroyed during a manage or
render sequence before the 3 second timeout expires. Add a null check to
handle this case.

 river/WindowManager.zig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/river/WindowManager.zig b/river/WindowManager.zig
index 011cd2a..3d2b552 100644
--- a/river/WindowManager.zig
+++ b/river/WindowManager.zig
@@ -378,12 +378,12 @@ fn handleTimeout(wm: *WindowManager) c_int {
 
             wm.renderStart();
         },
-        .manage, .render => {
+        .manage, .render => if (wm.object) |wm_v1| {
             log.err("window manager unresponsive for more than 3 seconds, disconnecting", .{});
-            wm.object.?.postError(.unresponsive, "unresponsive for more than 3 seconds");
+            wm_v1.postError(.unresponsive, "unresponsive for more than 3 seconds");
             // Don't wait for the frozen client to receive the protocol error
             // and exit of its own accord.
-            wm.object.?.getClient().destroy();
+            wm_v1.getClient().destroy();
         },
         .idle => unreachable,
     }