Fix crash on macos when resizing windows#3
Open
cyoung06 wants to merge 1 commit intoMinecraftMachina:masterfrom
Open
Fix crash on macos when resizing windows#3cyoung06 wants to merge 1 commit intoMinecraftMachina:masterfrom
cyoung06 wants to merge 1 commit intoMinecraftMachina:masterfrom
Conversation
|
This fix does indeed work. I've come up with a similar solution, I cleared the I support this PR to be merged. |
thecatcore
added a commit
to Legacy-Fabric/lwjgl
that referenced
this pull request
May 29, 2025
Taken from MinecraftMachina#3 Author: cyoung06
thecatcore
added a commit
to Legacy-Fabric/lwjgl
that referenced
this pull request
Sep 26, 2025
Taken from MinecraftMachina#3 Author: cyoung06 (cherry picked from commit edc2ac8)
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.
As far as I know, the crash is caused by two different threads accessing OpenGL context
_surfaceNeedsUpdate->[self update;]->[_openGLContext update];Two threads accessing same OpenGL context makes it crash.
According to https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_threading/opengl_threading.html
One solution is to use CGLLockContext and CGLUnlockContext properly, but it has to be done in both threads and it would be really hard to achieve
Or another solution is just prevent appkit thread from calling
[_openGLContext update];, since LWJGL application is going to do that some time later.This PR implements the second solution to the problem, by deleting one line from org_lwjgl_opengl_Display.m
I have tested this on Minecraft 1.8.9 on m1 arm, and it did not crash, and it didn't seem to have any side effects.
But I do consider this solution a bit hacky so it is up to you to accept this