cocoa: mark WindowListener's window ivar unretained

ARC requires an explicitly declared ivar behind an 'assign' object
property to be __unsafe_unretained; the Xcode build stopped on it.
RARCH_UNSAFE_UNRETAINED in cocoa_defines.h spells the qualifier under
ARC and nothing under MRC, so the declaration - which the fragile
32-bit runtime needs written out - reads the same for both.
This commit is contained in:
LibretroAdmin authored and libretroadmin committed 2026-09-06 06:21:52 +02:00
1 parent 1e62844f99
commit 9807e76a25
2 files changed
+8 -2

No files matched your search

@@ -173,6 +173,10 @@
#endif
#if __has_feature(objc_arc)
/* Ownership qualifier for an ivar that backs an 'assign' object
* property: ARC requires the ivar to say it does not retain, and no
* other compiler knows the word. */
#define RARCH_UNSAFE_UNRETAINED __unsafe_unretained
#define RARCH_RETAIN(x) (x)
#define RARCH_RELEASE(x) ((void)0)
#define RARCH_AUTORELEASE(x) ((void)0)
@@ -185,6 +189,7 @@
#define RARCH_AUTORELEASEPOOL_BEGIN @autoreleasepool {
#define RARCH_AUTORELEASEPOOL_END }
#else
#define RARCH_UNSAFE_UNRETAINED
#define RARCH_RETAIN(x) [(x) retain]
#define RARCH_RELEASE(x) [(x) release]
#define RARCH_AUTORELEASE(x) [(x) autorelease]
+3 -2
View File
@@ -131,8 +131,9 @@ UINavigationControllerDelegate> {
@interface WindowListener : NSResponder RARCH_PROTO_NSWINDOWDELEGATE
{
/* Declared, not synthesized: the fragile 32-bit runtime GCC 4.0
* targets cannot add ivars for a property on its own. */
NSWindow *_window;
* targets cannot add ivars for a property on its own. Unretained,
* as the assign property it backs requires under ARC. */
RARCH_UNSAFE_UNRETAINED NSWindow *_window;
}
/* assign (not retain) - WindowListener is a delegate; the window owns it, not vice versa */
@property (nonatomic, assign) NSWindow *window;