Skip to content

Commit 5320000

Browse files
authored
chore: fixes analyzer self retain warnings (#1263)
* Fixes warnings in iOS SDK * Fixes warnings in TwitterUtils
1 parent 668a42c commit 5320000

40 files changed

+392
-392
lines changed

Parse/Parse/Internal/ACL/DefaultACLController/PFDefaultACLController.m

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,40 +49,40 @@ + (instancetype)controllerWithDataSource:(id<PFCurrentUserControllerProvider>)da
4949

5050
- (BFTask<PFACL *> *)getDefaultACLAsync {
5151
return [_taskQueue enqueue:^id(BFTask *task) {
52-
if (!_defaultACL || !_useCurrentUser) {
53-
return _defaultACL;
52+
if (!self->_defaultACL || !self->_useCurrentUser) {
53+
return self->_defaultACL;
5454
}
5555

5656
PFCurrentUserController *currentUserController = self.dataSource.currentUserController;
5757
return [[currentUserController getCurrentObjectAsync] continueWithBlock:^id(BFTask *task) {
5858
PFUser *currentUser = task.result;
5959
if (!currentUser) {
60-
return _defaultACL;
60+
return self->_defaultACL;
6161
}
6262

63-
if (currentUser != _lastCurrentUser) {
64-
_defaultACLWithCurrentUser = [_defaultACL createUnsharedCopy];
65-
[_defaultACLWithCurrentUser setShared:YES];
66-
[_defaultACLWithCurrentUser setReadAccess:YES forUser:currentUser];
67-
[_defaultACLWithCurrentUser setWriteAccess:YES forUser:currentUser];
68-
_lastCurrentUser = currentUser;
63+
if (currentUser != self->_lastCurrentUser) {
64+
self->_defaultACLWithCurrentUser = [self->_defaultACL createUnsharedCopy];
65+
[self->_defaultACLWithCurrentUser setShared:YES];
66+
[self->_defaultACLWithCurrentUser setReadAccess:YES forUser:currentUser];
67+
[self->_defaultACLWithCurrentUser setWriteAccess:YES forUser:currentUser];
68+
self->_lastCurrentUser = currentUser;
6969
}
70-
return _defaultACLWithCurrentUser;
70+
return self->_defaultACLWithCurrentUser;
7171
}];
7272
}];
7373
}
7474

7575
- (BFTask<PFACL *> *)setDefaultACLAsync:(PFACL *)acl withCurrentUserAccess:(BOOL)accessForCurrentUser {
7676
return [_taskQueue enqueue:^id(BFTask *task) {
77-
_defaultACLWithCurrentUser = nil;
78-
_lastCurrentUser = nil;
77+
self->_defaultACLWithCurrentUser = nil;
78+
self->_lastCurrentUser = nil;
7979

80-
_defaultACL = [acl createUnsharedCopy];
81-
[_defaultACL setShared:YES];
80+
self->_defaultACL = [acl createUnsharedCopy];
81+
[self->_defaultACL setShared:YES];
8282

83-
_useCurrentUser = accessForCurrentUser;
83+
self->_useCurrentUser = accessForCurrentUser;
8484

85-
return _defaultACL;
85+
return self->_defaultACL;
8686
}];
8787
}
8888

Parse/Parse/Internal/Commands/CommandRunner/URLSession/PFURLSessionCommandRunner.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ - (void)dealloc {
152152
BOOL success = [command resolveLocalIds:&error];
153153
PFPreconditionReturnFailedTask(success, error);
154154
return [[self.requestConstructor getDataURLRequestAsyncForCommand:command] continueWithSuccessBlock:^id(BFTask <NSURLRequest *>*task) {
155-
return [_session performDataURLRequestAsync:task.result forCommand:command cancellationToken:cancellationToken];
155+
return [self->_session performDataURLRequestAsync:task.result forCommand:command cancellationToken:cancellationToken];
156156
}];
157157
} withOptions:options cancellationToken:cancellationToken];
158158
}
@@ -177,7 +177,7 @@ - (void)dealloc {
177177
return [[self.requestConstructor getFileUploadURLRequestAsyncForCommand:command
178178
withContentType:contentType
179179
contentSourceFilePath:sourceFilePath] continueWithSuccessBlock:^id(BFTask<NSURLRequest *> *task) {
180-
return [_session performFileUploadURLRequestAsync:task.result
180+
return [self->_session performFileUploadURLRequestAsync:task.result
181181
forCommand:command
182182
withContentSourceFilePath:sourceFilePath
183183
cancellationToken:cancellationToken
@@ -192,7 +192,7 @@ - (void)dealloc {
192192
progressBlock:(nullable PFProgressBlock)progressBlock {
193193
return [self _performCommandRunningBlock:^id {
194194
NSURLRequest *request = [NSURLRequest requestWithURL:url];
195-
return [_session performFileDownloadURLRequestAsync:request
195+
return [self->_session performFileDownloadURLRequestAsync:request
196196
toFileAtPath:filePath
197197
withCancellationToken:cancellationToken
198198
progressBlock:progressBlock];
@@ -241,7 +241,7 @@ - (BFTask *)_performCommandRunningBlock:(nonnull id (^)(void))block
241241
if ([task.error.userInfo[@"temporary"] boolValue] && attempts > 1) {
242242
PFLogError(PFLoggingTagCommon,
243243
@"Network connection failed. Making attempt %lu after sleeping for %f seconds.",
244-
(unsigned long)(_retryAttempts - attempts + 1), (double)delay);
244+
(unsigned long)(self->_retryAttempts - attempts + 1), (double)delay);
245245

246246
return [[BFTask taskWithDelay:(int)(delay * 1000)] continueWithBlock:^id(BFTask *task) {
247247
return [self _performCommandRunningBlock:block

Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ - (BFTask *)performDataURLRequestAsync:(NSURLRequest *)request
9999
}
100100

101101
__block NSURLSessionDataTask *task = nil;
102-
dispatch_sync(_sessionTaskQueue, ^{
103-
task = [_urlSession dataTaskWithRequest:request];
102+
dispatch_sync(self->_sessionTaskQueue, ^{
103+
task = [self->_urlSession dataTaskWithRequest:request];
104104
});
105105
PFURLSessionDataTaskDelegate *delegate = [PFURLSessionJSONDataTaskDelegate taskDelegateForDataTask:task
106106
withCancellationToken:cancellationToken];
@@ -125,8 +125,8 @@ - (BFTask *)performFileUploadURLRequestAsync:(NSURLRequest *)request
125125
}
126126

127127
__block NSURLSessionDataTask *task = nil;
128-
dispatch_sync(_sessionTaskQueue, ^{
129-
task = [_urlSession uploadTaskWithRequest:request fromFile:[NSURL fileURLWithPath:sourceFilePath]];
128+
dispatch_sync(self->_sessionTaskQueue, ^{
129+
task = [self->_urlSession uploadTaskWithRequest:request fromFile:[NSURL fileURLWithPath:sourceFilePath]];
130130
});
131131
PFURLSessionUploadTaskDelegate *delegate = [PFURLSessionUploadTaskDelegate taskDelegateForDataTask:task
132132
withCancellationToken:cancellationToken
@@ -151,8 +151,8 @@ - (BFTask *)performFileDownloadURLRequestAsync:(NSURLRequest *)request
151151
}
152152

153153
__block NSURLSessionDataTask *task = nil;
154-
dispatch_sync(_sessionTaskQueue, ^{
155-
task = [_urlSession dataTaskWithRequest:request];
154+
dispatch_sync(self->_sessionTaskQueue, ^{
155+
task = [self->_urlSession dataTaskWithRequest:request];
156156
});
157157
PFURLSessionFileDownloadTaskDelegate *delegate = [PFURLSessionFileDownloadTaskDelegate taskDelegateForDataTask:task
158158
withCancellationToken:cancellationToken
@@ -194,20 +194,20 @@ - (BFTask *)_performDataTask:(NSURLSessionDataTask *)dataTask withDelegate:(PFUR
194194
- (PFURLSessionDataTaskDelegate *)_taskDelegateForTask:(NSURLSessionTask *)task {
195195
__block PFURLSessionDataTaskDelegate *delegate = nil;
196196
dispatch_sync(_delegatesAccessQueue, ^{
197-
delegate = _delegatesDictionary[@(task.taskIdentifier)];
197+
delegate = self->_delegatesDictionary[@(task.taskIdentifier)];
198198
});
199199
return delegate;
200200
}
201201

202202
- (void)setDelegate:(PFURLSessionDataTaskDelegate *)delegate forDataTask:(NSURLSessionDataTask *)task {
203203
dispatch_barrier_async(_delegatesAccessQueue, ^{
204-
_delegatesDictionary[@(task.taskIdentifier)] = delegate;
204+
self->_delegatesDictionary[@(task.taskIdentifier)] = delegate;
205205
});
206206
}
207207

208208
- (void)_removeDelegateForTaskWithIdentifier:(NSNumber *)identifier {
209209
dispatch_barrier_async(_delegatesAccessQueue, ^{
210-
[_delegatesDictionary removeObjectForKey:identifier];
210+
[self->_delegatesDictionary removeObjectForKey:identifier];
211211
});
212212
}
213213

Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/TaskDelegate/PFURLSessionUploadTaskDelegate.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ - (void)URLSession:(NSURLSession *)session
4747
totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
4848
int progress = (int)round(totalBytesSent / (double)totalBytesExpectedToSend * 100);
4949
dispatch_async(dispatch_get_main_queue(), ^{
50-
if (_progressBlock) {
51-
_progressBlock(progress);
50+
if (self->_progressBlock) {
51+
self->_progressBlock(progress);
5252
}
5353
});
5454
}

Parse/Parse/Internal/Commands/PFRESTPushCommand.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ NS_ASSUME_NONNULL_BEGIN
2020

2121
PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFRESTPushCommand : PFRESTCommand
2222

23-
+ (instancetype)sendPushCommandWithPushState:(PFPushState *)state
24-
sessionToken:(nullable NSString *)sessionToken
25-
error:(NSError **)error;
23+
+ (nullable instancetype)sendPushCommandWithPushState:(PFPushState *)state
24+
sessionToken:(nullable NSString *)sessionToken
25+
error:(NSError **)error;
2626

2727
@end
2828

Parse/Parse/Internal/Config/Controller/PFConfigController.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ - (BFTask *)fetchConfigAsyncWithSessionToken:(NSString *)sessionToken {
7777
- (PFCurrentConfigController *)currentConfigController {
7878
__block PFCurrentConfigController *controller = nil;
7979
dispatch_sync(_dataAccessQueue, ^{
80-
if (!_currentConfigController) {
81-
_currentConfigController = [[PFCurrentConfigController alloc] initWithDataSource:self.dataSource];
80+
if (!self->_currentConfigController) {
81+
self->_currentConfigController = [[PFCurrentConfigController alloc] initWithDataSource:self.dataSource];
8282
}
83-
controller = _currentConfigController;
83+
controller = self->_currentConfigController;
8484
});
8585
return controller;
8686
}

Parse/Parse/Internal/Config/Controller/PFCurrentConfigController.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ + (instancetype)controllerWithDataSource:(id<PFPersistenceControllerProvider>)da
5555

5656
- (BFTask *)getCurrentConfigAsync {
5757
return [_dataTaskQueue enqueue:^id(BFTask *_) {
58-
if (!_currentConfig) {
58+
if (!self->_currentConfig) {
5959
return [[self _loadConfigAsync] continueWithSuccessBlock:^id(BFTask<PFConfig *> *task) {
60-
_currentConfig = task.result;
61-
return _currentConfig;
60+
self->_currentConfig = task.result;
61+
return self->_currentConfig;
6262
}];
6363
}
64-
return _currentConfig;
64+
return self->_currentConfig;
6565
}];
6666
}
6767

6868
- (BFTask *)setCurrentConfigAsync:(PFConfig *)config {
6969
@weakify(self);
7070
return [_dataTaskQueue enqueue:^id(BFTask *_) {
7171
@strongify(self);
72-
_currentConfig = config;
72+
self->_currentConfig = config;
7373

7474
NSDictionary *configParameters = @{ PFConfigParametersRESTKey : (config.parametersDictionary ?: @{}) };
7575
NSError *error;
@@ -88,7 +88,7 @@ - (BFTask *)clearCurrentConfigAsync {
8888
@weakify(self);
8989
return [_dataTaskQueue enqueue:^id(BFTask *_) {
9090
@strongify(self);
91-
_currentConfig = nil;
91+
self->_currentConfig = nil;
9292
return [[self.dataSource.persistenceController getPersistenceGroupAsync] continueWithSuccessBlock:^id(BFTask<id<PFPersistenceGroup>> *task) {
9393
return [task.result removeDataAsyncForKey:PFConfigCurrentConfigFileName_];
9494
}];
@@ -97,7 +97,7 @@ - (BFTask *)clearCurrentConfigAsync {
9797

9898
- (BFTask *)clearMemoryCachedCurrentConfigAsync {
9999
return [_dataTaskQueue enqueue:^id(BFTask *_) {
100-
_currentConfig = nil;
100+
self->_currentConfig = nil;
101101
return nil;
102102
}];
103103
}

Parse/Parse/Internal/File/Controller/PFFileController.m

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ + (instancetype)controllerWithDataSource:(id<PFCommandRunnerProvider, PFFileMana
7171
- (PFFileStagingController *)fileStagingController {
7272
__block PFFileStagingController *result = nil;
7373
dispatch_sync(_fileStagingControllerAccessQueue, ^{
74-
if (!_fileStagingController) {
75-
_fileStagingController = [PFFileStagingController controllerWithDataSource:self.dataSource];
74+
if (!self->_fileStagingController) {
75+
self->_fileStagingController = [PFFileStagingController controllerWithDataSource:self.dataSource];
7676
}
77-
result = _fileStagingController;
77+
result = self->_fileStagingController;
7878
});
7979
return result;
8080
}
@@ -119,14 +119,14 @@ - (PFFileStagingController *)fileStagingController {
119119
return task;
120120
}];
121121
}] continueWithBlock:^id(BFTask *task) {
122-
dispatch_barrier_async(_downloadDataAccessQueue, ^{
123-
[_downloadTasks removeObjectForKey:fileState.secureURLString];
124-
[_downloadProgressBlocks removeObjectForKey:fileState.secureURLString];
122+
dispatch_barrier_async(self->_downloadDataAccessQueue, ^{
123+
[self->_downloadTasks removeObjectForKey:fileState.secureURLString];
124+
[self->_downloadProgressBlocks removeObjectForKey:fileState.secureURLString];
125125
});
126126
return task;
127127
}];
128-
dispatch_barrier_async(_downloadDataAccessQueue, ^{
129-
_downloadTasks[fileState.secureURLString] = resultTask;
128+
dispatch_barrier_async(self->_downloadDataAccessQueue, ^{
129+
self->_downloadTasks[fileState.secureURLString] = resultTask;
130130
});
131131
}
132132
return resultTask;
@@ -158,8 +158,8 @@ - (PFFileStagingController *)fileStagingController {
158158

159159
- (BFTask *)_fileDownloadResultTaskForFileWithState:(PFFileState *)state {
160160
__block BFTask *resultTask = nil;
161-
dispatch_sync(_downloadDataAccessQueue, ^{
162-
resultTask = _downloadTasks[state.secureURLString];
161+
dispatch_sync(self->_downloadDataAccessQueue, ^{
162+
resultTask = self->_downloadTasks[state.secureURLString];
163163
});
164164
return resultTask;
165165
}
@@ -168,8 +168,8 @@ - (PFProgressBlock)_fileDownloadUnifyingProgressBlockForFileState:(PFFileState *
168168
return ^(int progress) {
169169
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
170170
__block NSArray *blocks = nil;
171-
dispatch_sync(_downloadDataAccessQueue, ^{
172-
blocks = [_downloadProgressBlocks[fileState.secureURLString] copy];
171+
dispatch_sync(self->_downloadDataAccessQueue, ^{
172+
blocks = [self->_downloadProgressBlocks[fileState.secureURLString] copy];
173173
});
174174
if (blocks.count != 0) {
175175
dispatch_async(dispatch_get_main_queue(), ^{
@@ -187,11 +187,11 @@ - (void)_addFileDownloadProgressBlock:(PFProgressBlock)block forFileWithState:(P
187187
return;
188188
}
189189

190-
dispatch_barrier_async(_downloadDataAccessQueue, ^{
191-
NSMutableArray *progressBlocks = _downloadProgressBlocks[state.secureURLString];
190+
dispatch_barrier_async(self->_downloadDataAccessQueue, ^{
191+
NSMutableArray *progressBlocks = self->_downloadProgressBlocks[state.secureURLString];
192192
if (!progressBlocks) {
193193
progressBlocks = [NSMutableArray arrayWithObject:block];
194-
_downloadProgressBlocks[state.secureURLString] = progressBlocks;
194+
self->_downloadProgressBlocks[state.secureURLString] = progressBlocks;
195195
} else {
196196
[progressBlocks addObject:block];
197197
}

Parse/Parse/Internal/Installation/CurrentInstallationController/PFCurrentInstallationController.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ - (BFTask *)getCurrentObjectAsync {
128128
return installation;
129129
}];
130130
}] continueWithBlock:^id(BFTask *task) {
131-
dispatch_barrier_sync(_dataQueue, ^{
132-
_currentInstallation = task.result;
133-
_currentInstallationMatchesDisk = !task.faulted;
131+
dispatch_barrier_sync(self->_dataQueue, ^{
132+
self->_currentInstallation = task.result;
133+
self->_currentInstallationMatchesDisk = !task.faulted;
134134
});
135135
return task;
136136
}];
@@ -167,9 +167,9 @@ - (BFTask *)clearCurrentInstallationAsync {
167167
return [_dataTaskQueue enqueue:^BFTask *(BFTask *unused) {
168168
@strongify(self);
169169

170-
dispatch_barrier_sync(_dataQueue, ^{
171-
_currentInstallation = nil;
172-
_currentInstallationMatchesDisk = NO;
170+
dispatch_barrier_sync(self->_dataQueue, ^{
171+
self->_currentInstallation = nil;
172+
self->_currentInstallationMatchesDisk = NO;
173173
});
174174

175175
NSMutableArray *tasks = [NSMutableArray arrayWithCapacity:2];
@@ -252,30 +252,30 @@ - (PFInstallationIdentifierStore *)installationIdentifierStore {
252252
- (PFInstallation *)currentInstallation {
253253
__block PFInstallation *installation = nil;
254254
dispatch_sync(_dataQueue, ^{
255-
installation = _currentInstallation;
255+
installation = self->_currentInstallation;
256256
});
257257
return installation;
258258
}
259259

260260
- (void)setCurrentInstallation:(PFInstallation *)currentInstallation {
261261
dispatch_barrier_sync(_dataQueue, ^{
262-
if (_currentInstallation != currentInstallation) {
263-
_currentInstallation = currentInstallation;
262+
if (self->_currentInstallation != currentInstallation) {
263+
self->_currentInstallation = currentInstallation;
264264
}
265265
});
266266
}
267267

268268
- (BOOL)currentInstallationMatchesDisk {
269269
__block BOOL matches = NO;
270270
dispatch_sync(_dataQueue, ^{
271-
matches = _currentInstallationMatchesDisk;
271+
matches = self->_currentInstallationMatchesDisk;
272272
});
273273
return matches;
274274
}
275275

276276
- (void)setCurrentInstallationMatchesDisk:(BOOL)currentInstallationMatchesDisk {
277277
dispatch_barrier_sync(_dataQueue, ^{
278-
_currentInstallationMatchesDisk = currentInstallationMatchesDisk;
278+
self->_currentInstallationMatchesDisk = currentInstallationMatchesDisk;
279279
});
280280
}
281281

Parse/Parse/Internal/KeyValueCache/PFKeyValueCache.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ - (void)removeAllObjects {
178178

179179
dispatch_sync(_diskCacheQueue, ^{
180180
// Directory will be automatically recreated the next time 'cacheDir' is accessed.
181-
[self.fileManager removeItemAtURL:_cacheDirectoryURL error:NULL];
181+
[self.fileManager removeItemAtURL:self->_cacheDirectoryURL error:NULL];
182182
});
183183
}
184184

0 commit comments

Comments
 (0)