Merge pull request #687 from mitchellh/cancel

renderer: handle error.NotFound for timer cancellation
This commit is contained in:
Mitchell Hashimoto
2023-10-15 21:44:42 -07:00
committed by GitHub

View File

@ -382,11 +382,13 @@ fn cursorCancelCallback(
// support different sets of errors, so we just unify it. // support different sets of errors, so we just unify it.
const CancelError = xev.Timer.CancelError || error{ const CancelError = xev.Timer.CancelError || error{
Canceled, Canceled,
NotFound,
Unexpected, Unexpected,
}; };
_ = r catch |err| switch (@as(CancelError, @errorCast(err))) { _ = r catch |err| switch (@as(CancelError, @errorCast(err))) {
error.Canceled => {}, error.Canceled => {}, // success
error.NotFound => {}, // completed before it could cancel
else => { else => {
log.warn("error in cursor cancel callback err={}", .{err}); log.warn("error in cursor cancel callback err={}", .{err});
unreachable; unreachable;