Skip to content
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

Crash on window resize when rendering on another thread #3600

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Crash on window resize when rendering on another thread #3600

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: macOS 10.15, x86

Comments on the original bug report:

On 2020-03-20 08:56:40 +0000, Emir Marincic wrote:

Created attachment 4271
performSelectorOnMainThread patch

Resizing a window schedules an update on the SDLOpenGLContext, the next swap on the auxiliary thread doing the rendering causes a [NSOpenGLContext update] on that thread, which is not allowed.

[NSOpenGLContext update] only started checking whether it's called from the main thread (through pthread_main_np) from Catalina onwards and AppKit uses _CFExecutableLinkedOnOrAfter to provide compatibility for older executables by setting NSOpenGLContextSuppressThreadAssertions.

I'm not sure if this should be supported but swapping on a separate thread works on enough platforms that we didn't notice this bug for years. Calling update on the main thread instead through performSelectorOnMainThread seems to work fine and after testing a couple of hours I didn't notice any undesired effects.

I've attached the patch I've been testing locally

Best regards
Emir

On 2020-03-20 19:10:23 +0000, Sam Lantinga wrote:

Looks good, thanks!
https://hg.libsdl.org/SDL/rev/c8f27a5e868e

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

No branches or pull requests

1 participant