diff options
| author | Isaac Freund <mail@isaacfreund.com> | 2023-01-07 17:35:22 +0100 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2023-01-07 17:35:22 +0100 |
| commit | 4dd02358d92050ad55f7b3c095d8a2ea0f94f607 (patch) | |
| tree | 810b77b3bebf8bfe838a9e61b4ef288533d9f35b | |
| parent | f511a34dedfd5b3bed5bd9d078530adf4c26c83c (diff) | |
| download | river-4dd02358d92050ad55f7b3c095d8a2ea0f94f607.tar.gz river-4dd02358d92050ad55f7b3c095d8a2ea0f94f607.tar.xz | |
session-lock: fix assertion failure on abnormal client behavior
If the client commits a protocol error or otherwise crashes before the
session has been fully locked, we currently try to send the locked event
without checking if the client has been destroyed.
This commit adds the necessary if statement.
| -rw-r--r-- | river/LockManager.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/river/LockManager.zig b/river/LockManager.zig index 6723bd4..66deff6 100644 --- a/river/LockManager.zig +++ b/river/LockManager.zig @@ -164,13 +164,15 @@ pub fn maybeLock(manager: *LockManager) void { switch (manager.state) { .waiting_for_lock_surfaces => if (all_outputs_rendered_lock_surface) { log.info("session locked", .{}); - manager.lock.?.sendLocked(); + // The lock client may have been destroyed, for example due to a protocol error. + if (manager.lock) |lock| lock.sendLocked(); manager.state = .locked; manager.lock_surfaces_timer.timerUpdate(0) catch {}; }, .waiting_for_blank => if (all_outputs_blanked) { log.info("session locked", .{}); - manager.lock.?.sendLocked(); + // The lock client may have been destroyed, for example due to a protocol error. + if (manager.lock) |lock| lock.sendLocked(); manager.state = .locked; }, .unlocked, .locked => unreachable, |
