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

[Patch] Mac/iOS: SDL_SysWMinfo struct can't be created in ObjC files which use ARC #1563

Closed
SDLBugzilla opened this issue Feb 10, 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: Mac OS X (All), x86

Comments on the original bug report:

On 2014-07-14 02:55:25 +0000, Alex Szpakowski wrote:

Created attachment 1753
Fix for including SDL_syswm.h in ObjC files which use ARC

In OS X and iOS, the SDL_SysWMinfo struct contains a struct which has an Objective-C object (an NSWindow or UIWindow for OS X or iOS respectively.)

When using Objective-C's Automatic Reference Counting mode in a file, Objective-C objects normally aren't allowed to be inside C structs or unions unless they're tagged with '__unsafe_unretained'.

The NSWindow and UIWindow objects in the SDL_SysWMinfo struct don't have that tag right now, which is a problem because an Objective-C file using ARC can include SDL_syswm.h but the compiler won't the struct be constructed in that file.

I have attached a patch which properly tags the objects in the struct with '__unsafe_unretained' when SDL_syswm.h is included in a file which uses Objective-C's ARC.
This shouldn't affect internal SDL behaviour at all, since none of its Objective-C code uses ARC (yet.)

On 2014-07-30 18:14:58 +0000, Ryan C. Gordon wrote:

This is now https://hg.libsdl.org/SDL/rev/d6464107048c, thanks!

--ryan.

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