Wayland: fail window creation cleanly when the OpenGL context cannot be created

_glfwPlatformCreateWindow() ignored the return value of
attach_opengl_context_to_window(), so when EGL is unavailable (for
example libEGL cannot be loaded) it reported success with
window->context left zeroed. glfwCreateWindow() then proceeded to
_glfwRefreshContextAttribs() -> glfwMakeContextCurrent(), which calls
the NULL context.makeCurrent pointer: kitty crashes with SIGSEGV
instead of reporting "Failed to create GLFWwindow. This usually
happens because of old/broken OpenGL drivers." as intended. The X11
backend already propagates these failures.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Sinity
2026-07-11 21:04:38 +02:00
parent 2607d22ac3
commit 0dc74cd93b

2
glfw/wl_window.c vendored
View File

@@ -1509,7 +1509,7 @@ int _glfwPlatformCreateWindow(
// and only then create the OpenGL context.
if (window->wl.visible) loop_till_window_fully_created(window);
debug("Creating OpenGL context and attaching it to window\n");
if (ctxconfig->client != GLFW_NO_API) attach_opengl_context_to_window(window, ctxconfig, fbconfig);
if (ctxconfig->client != GLFW_NO_API && !attach_opengl_context_to_window(window, ctxconfig, fbconfig)) return false;
return true;
}