From 0dc74cd93b578f9869b110750d83be0c5ffec14b Mon Sep 17 00:00:00 2001 From: Sinity Date: Sat, 11 Jul 2026 21:04:38 +0200 Subject: [PATCH] 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 --- glfw/wl_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glfw/wl_window.c b/glfw/wl_window.c index cb3f688f4..6abb77d17 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -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; }