Repository navigation
[rcore] Fix CloseWindow() crash after InitWindow() failed - #6353
Open
jayhemnani9910 wants to merge 3 commits into
Open
jayhemnani9910 wants to merge 3 commits into
jayhemnani9910 wants to merge 3 commits into
Conversation
|
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. |
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 |
raysan5
reviewed
Nov 3, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 calledUnloadFontDefault()andrlglClose(), 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 whenCORE.Window.readyis set; the platform close and theCOREreset 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.