-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS: Dispatch GL calls to main thread to prevent crashes on Catalina #8544
Conversation
This doesn't seem like the best solution to me, as there's a potential race if the core shuts down and the main thread is blocked/hasn't processed the event yet. Furthermore, what happens if the main thread is blocked for too long and the video thread starts issuing GL commands? We already have a backend function which gets called from the main thread here (needed for Vulkan sillyness on macOS): https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/VideoBackendBase.h#L48 Unfortunately this would require a little more refactoring, as currently the GL context is created on the video thread so at the time that function is called, it does not exist yet. Ideally, we'd do the context creation first, and this is something I've been planning on refactoring for a while but haven't got around to it. So, in the meantime, this might be a potential solution.. it's not like we're particularly "stable" on macOS anyway.. |
Thanks for the quick feedback @stenzek. These are dispatch_sync'd so whatever threads are calling these functions would block until the main thread returns. I'm not familiar enough with the source code to suggest anything better, in particular if the ownership of the captured pointers is managed by a thread outside of the calling threads then that would most definitely lead to a crash. |
I think it's an acceptable compromise for now, as the fix is nice and self-contained. Thanks for debugging the issue! Might I request that you add a comment to the added lines, just something along the lines of |
Sure, no problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I tried to exit Dolphin for my Catalina and it wont exit so I click Force Quit and now I got this message: You have forced Dolphin to quit and I click Ignored and it disappear. Is there a way to fix it ? |
You probably want to cherry-pick #8530 into your build. |
pr-osx-x64 — Build failed on builder pr-osx-x64 |
It builds fine. Rerun cmake, make and you’re off to the races. |
I cannot builds it. Can you give us an instruction for Catalina users please ? It would be great. |
Follow the instructions in the As an aside, we probably should just merge the 10.12 change and fix the builder later. |
Hello, everybody. First time here.
I discovered Dolphin today and tried out the development build on Catalina. It didn't work too well with a bunch of hanging, so I built it up and pulled in #8530 to fix some of the chronic hangs and non-responsive controllers.
After configuring my controllers, selecting a ROM immediately led to this crash in AttachContextToView:
After fixing that, I was confronted with this crash in GLContextAGL::Update:
This pull request addresses both crashes, and I can play a ROM with my 8bitDo SN30 on Catalina.