Output: fix possible crash on destroy

This commit is contained in:
Isaac Freund 2024-01-05 12:50:36 -06:00
parent 393bfb42b9
commit 9aa0f1a9a6
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -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", .{});