diff --git a/imgui-winit-support/src/lib.rs b/imgui-winit-support/src/lib.rs index 2cd42f6..191fe32 100644 --- a/imgui-winit-support/src/lib.rs +++ b/imgui-winit-support/src/lib.rs @@ -199,7 +199,11 @@ fn check_multiple_winits() { // Note that the `Ordering` basically doesn't matter here, but even if it // did, `Relaxed` is still correct because we're only interested in the // effects on a single atomic variable. - if winits_enabled <= 1 || COMPLAINED.compare_and_swap(false, true, Ordering::Relaxed) { + if winits_enabled <= 1 + || COMPLAINED + .compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed) + .is_err() + { return; } let mut err = Vec::with_capacity(512);