| Summary: | [Patch] Mac/iOS: SDL_SysWMinfo struct can't be created in ObjC files which use ARC | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Alex Szpakowski <amaranth72> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Mac OS X (All) | ||
| Attachments: | Fix for including SDL_syswm.h in ObjC files which use ARC | ||
This is now https://hg.libsdl.org/SDL/rev/d6464107048c, thanks! --ryan. |
Created attachment 1753 [details] 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.)