From ef86e56ac7c003baf8d9d974febef719d7c3a00c Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 7 Mar 2022 18:17:50 +0100 Subject: [PATCH] Keep the first X11 error --- src/gl/x11/errors.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gl/x11/errors.rs b/src/gl/x11/errors.rs index 965d755..87d5287 100644 --- a/src/gl/x11/errors.rs +++ b/src/gl/x11/errors.rs @@ -45,10 +45,13 @@ impl<'a> XErrorHandler<'a> { let err = *err; CURRENT_X11_ERROR.with(|mutex| match mutex.lock() { - Ok(mut current_error) => { + // If multiple errors occur, keep the first one since that's likely going to be the + // cause of the other errors + Ok(mut current_error) if current_error.is_none() => { *current_error = Some(err); 0 } + Ok(_) => 0, Err(e) => { eprintln!( "[FATAL] raw-gl-context: Failed to lock for X11 Error Handler: {:?}",