-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Linux/X11] Add a default error handler for X11 to avoid crashes. #75099
[Linux/X11] Add a default error handler for X11 to avoid crashes. #75099
Conversation
clang-format makes the multiline string unreadable. Any advice on that? |
@mxnemu the rest of the code uses OS::get_singleton()->alert(
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
"You can enable the OpenGL 3 driver by starting the engine from the\n"
"command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
"If you recently updated your video card drivers, try rebooting.",
executable_name),
"Unable to initialize Vulkan video driver");
Edit: just noticed that those aren't variadic arguments lol. Glad to have put the example as otherwise I would have messed up things further. |
31f4bd2
to
1434ad2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this but it looks fine!
Since the bugs aren't super easy to reproduce without installing a new window manager and configuring smart-borders, here are screenshots of my tests on This branch - The godot window stays open and usable when an error occures: This branch - Using Godot 4.0 before the patch - the window crashes on focus change as described in the issue reports: |
Can this get merged now, so it will be in the next dev-snapshot and people can report anything unexpected? |
"\n Major opcode of failed request: %d" | ||
"\n Serial number of failed request: %d" | ||
"\n Current serial number in output stream: %d", | ||
String(message), error->request_code, error->minor_code, error->serial)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String(message), error->request_code, error->minor_code, error->serial)); | |
String::utf8(message), error->request_code, error->minor_code, error->serial)); |
According to docs: "The returned text is in the encoding of the current locale.", so it's likely UTF-8 in most cases, String(x)
is for ASCII only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mxnemu Are you able to do this change? This seems to be the only step left before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I just tested it locally and amended my commit. 👍
Sorry for my delay and thanks for the help everyone.
For the record, your commit seems not to be linked to your GitHub account. See: Why are my commits linked to the wrong user? for more info. |
The default behaviour for X11 is to crash even on non-fatal errors when there is no error handler set. This change allows the window to stay open and may enable users to save their work when things go wrong. This acts as a workaround for godotengine#65425 and godotengine#68471
1434ad2
to
b13c82e
Compare
Thanks! And congrats for your first merged Godot contribution 🎉 |
The default behaviour for X11 is to crash even on non-fatal errors when there is no error handler set. This change allows the window to stay open and may enable users to save their work when things go wrong.
This acts as a workaround for #65425 and #68471