Commit 0ed525c
committed
record/avfoundation: use cocoa_defines.h macros instead of rolling our own
libretro-common/include/defines/cocoa_defines.h already provides
RARCH_RELEASE / RARCH_RETAIN / RARCH_AUTORELEASE / RARCH_SUPER_DEALLOC
for ARC/MRR-neutral Objective-C memory management, and is the
established convention across ui_cocoa.m / cocoa_common.m /
ui_cocoatouch.m / dispserv_apple.m / coreaudio.c. The local
RA_RELEASE_OBJ / RA_RELEASE_DQ macros added in b327848 solved the
same problem with ad-hoc spelling. Adopt the project convention.
Changes:
* libretro-common/include/defines/cocoa_defines.h: add
RARCH_DISPATCH_RELEASE(x) alongside the existing four macros.
The GCD variant needs its own spelling because [x release] is a
compile error on pre-10.8 SDKs where OS_OBJECT_USE_OBJC is 0 and
dispatch_queue_t is a plain C handle rather than an ObjC object;
dispatch_release() works uniformly on all MRR-capable SDKs.
NULL-guarded because dispatch_release(NULL) is explicitly
undefined (unlike [nil release] which is a defined no-op).
* record/drivers/record_avfoundation.m: drop the local ~30-line
macro block, #include <defines/cocoa_defines.h>, and replace
the five call sites. The project convention splits the release
and the nil-assignment into two lines rather than bundling them
into a compound macro; follow suit. Semantics are identical:
MRC: [field release]; field = nil;
ARC: ((void)0); field = nil; (release happens via the
__strong auto-qualifier
on the struct member
triggered by the assignment)
No behavior change on any build path. The existing tests for the
MRC leak fix from b327848 continue to pass (the ivars end up nil-
valued and the objects released exactly once in both modes).
Camera-side counterpart (camera/drivers/avfoundation.m) does not
need the same treatment: it uses @Property (strong, nonatomic) on
an @interface (clang auto-synthesizes correct MRC retain semantics
from the strong attribute), its private struct ivars are plain C
pointers that ObjC memory management does not apply to, and there
is no -dealloc override.1 parent 3171f79 commit 0ed525c
2 files changed
Lines changed: 31 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | 37 | | |
67 | 38 | | |
68 | 39 | | |
| |||
170 | 141 | | |
171 | 142 | | |
172 | 143 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
178 | 163 | | |
179 | 164 | | |
180 | 165 | | |
| |||
373 | 358 | | |
374 | 359 | | |
375 | 360 | | |
376 | | - | |
| 361 | + | |
| 362 | + | |
377 | 363 | | |
378 | 364 | | |
379 | 365 | | |
| |||
0 commit comments