You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OSX/MACOS/COCOATOUCH: Normalise MRR safety in ui_cocoatouch.m
Applies the same treatment to ui_cocoatouch.m that e9279a8 and
bd45086 applied to ui_cocoa.m / cocoa_gl_ctx.m: make the file
correct under both ARC and MRR via the RARCH_*/#if
__has_feature(objc_arc) dance the rest of the Cocoa code uses.
Every shipping iOS Xcode project sets CLANG_ENABLE_OBJC_ARC=YES,
so none of the MRR leaks listed below bite any current build;
this is future-proofing / consistency with ui_cocoa.m rather
than bug-fixing today. The one thing that does change in
practice is that the file now compiles under MRR at all - the
previous (nonatomic, strong) on keyboardTextField was an
ARC-only keyword that failed to parse under the pre-ARC
compiler.
Header changes (apple_platform.h):
The RetroArch_iOS properties were spelled with bare
(nonatomic), relying on ARC's implicit 'strong' default for
object-typed properties. Under MRR the default is 'assign',
which is silently wrong - the referent is released at the
next autorelease-pool drain after assignment. Spell the
ownership out: window and bgDate become (nonatomic, retain),
documentsDirectory becomes (nonatomic, copy) to match the
NSString convention. menu_count (int) stays bare (nonatomic)
since 'assign' is correct for scalars. Under ARC these
qualifiers are accepted and behave identically to 'strong' /
defaults.
Implementation changes (ui_cocoatouch.m):
- Include <defines/cocoa_defines.h> for the RARCH_* macros.
- The private category's (nonatomic, strong) UITextField
*keyboardTextField becomes (nonatomic, retain). Identical
behaviour under ARC; parseable under MRR.
- -setViewType: adopts the +1-invariant pattern e9279a8
introduced for ui_cocoa.m. _renderView is released via
RARCH_RELEASE before the ivar is nilled on teardown; the
VULKAN and METAL branches take their +1 directly from +new;
the OPENGL_ES branch takes it via RARCH_RETAIN of the
glkitview_init() singleton so the ivar's ownership is
uniform across all three paths. UIPointerInteraction's
alloc+init is autoreleased to balance -addInteraction:'s
internal retain.
- Every other local +1 producer (+[KSCrashConfiguration new],
+[KSCrashReportStoreConfiguration new], -mutableCopy,
[[NSString alloc] initWithData:...] in three places,
[[NSDateFormatter alloc] init], [[UIWindow alloc]
initWithFrame:...], [[NSURLComponents alloc]
initWithURL:...], [[UITextField alloc]
initWithFrame:...]) is paired with a RARCH_AUTORELEASE on
the following line. The two sites that assign to retain
properties (self.window and self.keyboardTextField) use an
explicit temp so the alloc can be autoreleased before the
setter takes its own retain - this is the classic pre-ARC
[[[Class alloc] init...] autorelease] -> self.prop = ...
idiom, spelled out across three statements so the macro
only ever appears in statement form.
(RARCH_AUTORELEASE expands to ((void)0) under ARC - it is
statement-only, not expression-form. See aed4543.)
- Adds an MRR-only -dealloc that RARCH_RELEASEs every
retained ivar / property and calls RARCH_SUPER_DEALLOC(),
mirroring ui_cocoa.m. RetroArch_iOS is the UIApplication
delegate so this dealloc effectively never runs in
practice, but it completes the ownership picture and keeps
both files in step.
cocoa_vk_ctx.m was already clean (audited in the same pass
as bd45086); no changes there.
0 commit comments