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

commitcdeb597754b64da65e8e44975d4b15c221837146
parent642126712c
authorIsaac Freund <[email protected]>
date2024-01-05 12:50
Output: fix possible crash on destroy

 river/Root.zig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/river/Root.zig b/river/Root.zig
index 0608287..8831203 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -856,7 +856,8 @@ fn handleSetGamma(
     _: *wl.Listener(*wlr.GammaControlManagerV1.event.SetGamma),
     event: *wlr.GammaControlManagerV1.event.SetGamma,
 ) void {
-    const output: *Output = @ptrFromInt(event.output.data);
+    // The output may have been destroyed, in which case there is nothing to do
+    const output = @as(?*Output, @ptrFromInt(event.output.data)) orelse return;
 
     std.log.debug("client requested to set gamma", .{});