Commit dc79a1e
committed
Makefile: build cocoa_input.m and corelocation.m with -fobjc-arc
Two more files in the same situation as audio/drivers/coreaudio3.m
(commit 3498771): written assuming ARC, but compiled under MRC
by the top-level qb Makefile. Under the Xcode builds they are
already ARC (both get pulled in via griffin/griffin_objc.m which
is compiled with CLANG_ENABLE_OBJC_ARC=YES per pkg/apple/
BaseConfig.xcconfig:182), so the qb Makefile was the outlier.
=== input/drivers/cocoa_input.m ===
ARC-shaped signals (checked against the full list in libretro-
common/include/defines/cocoa_defines.h line 85+):
[x release] 0 sites
[x retain] 0 sites
[x autorelease] 0 sites
[super dealloc] 0 sites
NSAutoreleasePool 0 sites
RARCH_RELEASE/... 0 sites
alloc] init 4 sites (lines 387, 399, 947, 1013)
'x = nil' releases 6 sites (lines 753, 754, 759, 955, 984, 985)
The file is written throughout with ARC idioms: 'x = nil' to
release (a no-op under MRC - leaks the prior value); strong-ivar
assignment 'keypressHapticPlayer = [keypressHapticEngine
createPlayerWithPattern:...]' without manual retain; no dealloc
method to release ivars (ARC synthesises one; MRC doesn't).
Concrete per-keystroke MRC leak at lines ~1001-1014: five
alloc+init pairs (CHHapticEventParameter intense/sharp,
CHHapticEvent event, CHHapticPattern pattern, [[NSArray alloc]
init]) created once on haptic-enabled key presses, none released.
Under MRC all five leak. Under ARC the locals go out of scope
and release automatically.
=== location/drivers/corelocation.m ===
Same ARC-only shape. Zero manual retain/release anywhere.
Two alloc+init sites (lines 33, 42) stored into a shared
singleton and into a strong ivar respectively:
sharedInstance = [[CoreLocationManager alloc] init]; // line 33
_locationManager = [[CLLocationManager alloc] init]; // line 42
No dealloc method defined. Under ARC the synthesised dealloc
releases the strong ivars on object destruction; under MRC
those +1 retains leak for the process lifetime.
=== Fix ===
Add both to the per-file -fobjc-arc override list alongside
metal.o, mfi_joypad.o, and coreaudio3.o. Matches the author's
clear intent and aligns qb with the Xcode build mode for these
files.
Thread-safety: unchanged - this is a compile-flag change only.
With ARC on, the existing ivar assignments and singleton setup
produce correct retain counts; under MRC they were silently
leaking.
Reachability: cocoa_input.m is always built on macOS/iOS
(Makefile.common:2625), so the qb-MRC haptic path leaks on every
keystroke for anyone who has haptic feedback enabled on iOS.
corelocation.m is opt-in via --enable-corelocation; leaks are
confined to process startup (one-shot +1 on the singleton and
its manager) and do not grow per-use.1 parent f8ef764 commit dc79a1e
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
| |||
0 commit comments