镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[rcore] Fix CloseWindow() crash after InitWindow() failed - #6353

Open
jayhemnani9910 wants to merge 3 commits into
raysan5:masterfrom
jayhemnani9910:fix-closewindow-after-failed-init
Open

jayhemnani9910 wants to merge 3 commits into
raysan5:masterfrom
jayhemnani9910:fix-closewindow-after-failed-init

Conversation

@jayhemnani9910

@jayhemnani9910 jayhemnani9910 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6351.

When the platform can't be initialized (for example no display: DISPLAY= WAYLAND_DISPLAY= ./core_basic_window), InitWindow() returns early, before rlgl and the default font are loaded. CloseWindow() still called UnloadFontDefault() and rlglClose(), which go through GL functions that were never loaded and segfault.

CloseWindow() now unloads the default font and rlgl, and logs "Window closed successfully", only when CORE.Window.ready is set; the platform close and the CORE reset still run.

Tested on Linux, PLATFORM_DESKTOP (GLFW, X11): InitWindow(320, 240, "t"); CloseWindow(); run with no display segfaults on master (exit 139) and exits 0 with this change, without the "Window closed successfully" line. With a window, on PLATFORM_MEMORY, the same program still unloads everything and prints that line. A real GLFW window was not run.

@SirNate0

SirNate0 commented Nov 2, 2026

Copy link
Copy Markdown

Technically the log message is incorrect with the change. The window was not closed at all, as there was no window to close, though the rest of the platform was uninitialized.

@jayhemnani9910

Copy link
Copy Markdown
Contributor Author

Good point, fixed: the line now prints only if there was a window. With no display, the program exits 0 without it. With a window on PLATFORM_MEMORY, it still prints.

Comment thread src/rcore.c Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rcore] CloseWindow segmentation fault with no display

3 participants