lib/wayland/src/runtime/lifecycle.zig
daab053ee43316e1809a84551d573ddd1e5bf3d2
1 const std = @import("std");
2 const wayland = @import("../root.zig");
3 const object = @import("object.zig");
4
5 pub fn retire(
6 ids: *wayland.ids.Pool,
7 objects: *object.Table,
8 id: u32,
9 expected: object.Entry,
10 state: object.State,
11 ) void {
12 const actual = objects.requireLive(id) catch unreachable;
13 std.debug.assert(actual.interface == expected.interface);
14 std.debug.assert(actual.version == expected.version);
15 std.debug.assert(actual.origin == expected.origin);
16 objects.retire(id, state) catch unreachable;
17 if (expected.origin == .client) ids.retire(id) catch unreachable;
18 }