Skip to content

Commit

Permalink
Merge pull request #1078 from rnapier/fix/implicit-self-warnings
Browse files Browse the repository at this point in the history
Fixes #1077 "Block implicity retains 'self'" warnings
  • Loading branch information
chrisballinger authored Jul 10, 2018
2 parents d34571e + 0e178cb commit 2199643
Show file tree
Hide file tree
Showing 51 changed files with 1,234 additions and 1,236 deletions.
22 changes: 11 additions & 11 deletions Core/XMPPModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ - (BOOL)activate:(XMPPStream *)aXmppStream

dispatch_block_t block = ^{

if (xmppStream != nil)
if (self->xmppStream != nil)
{
result = NO;
}
else
{
xmppStream = aXmppStream;
self->xmppStream = aXmppStream;

[xmppStream addDelegate:self delegateQueue:moduleQueue];
[xmppStream registerModule:self];
[self->xmppStream addDelegate:self delegateQueue:self->moduleQueue];
[self->xmppStream registerModule:self];

[self didActivate];
}
Expand Down Expand Up @@ -115,14 +115,14 @@ - (void)deactivate
{
dispatch_block_t block = ^{

if (xmppStream)
if (self->xmppStream)
{
[self willDeactivate];

[xmppStream removeDelegate:self delegateQueue:moduleQueue];
[xmppStream unregisterModule:self];
[self->xmppStream removeDelegate:self delegateQueue:self->moduleQueue];
[self->xmppStream unregisterModule:self];

xmppStream = nil;
self->xmppStream = nil;
}
};

Expand Down Expand Up @@ -165,7 +165,7 @@ - (XMPPStream *)xmppStream
__block XMPPStream *result;

dispatch_sync(moduleQueue, ^{
result = xmppStream;
result = self->xmppStream;
});

return result;
Expand All @@ -177,7 +177,7 @@ - (void)addDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue
// Asynchronous operation (if outside xmppQueue)

dispatch_block_t block = ^{
[multicastDelegate addDelegate:delegate delegateQueue:delegateQueue];
[self->multicastDelegate addDelegate:delegate delegateQueue:delegateQueue];
};

if (dispatch_get_specific(moduleQueueTag))
Expand All @@ -189,7 +189,7 @@ - (void)addDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue
- (void)removeDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue synchronously:(BOOL)synchronously
{
dispatch_block_t block = ^{
[multicastDelegate removeDelegate:delegate delegateQueue:delegateQueue];
[self->multicastDelegate removeDelegate:delegate delegateQueue:delegateQueue];
};

if (dispatch_get_specific(moduleQueueTag))
Expand Down
20 changes: 10 additions & 10 deletions Core/XMPPParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -792,14 +792,14 @@ - (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQ

dispatch_block_t block = ^{

delegate = newDelegate;
self->delegate = newDelegate;

#if !OS_OBJECT_USE_OBJC
if (delegateQueue)
dispatch_release(delegateQueue);
#endif

delegateQueue = newDelegateQueue;
self->delegateQueue = newDelegateQueue;
};

if (dispatch_get_specific(xmppParserQueueTag))
Expand All @@ -812,27 +812,27 @@ - (void)parseData:(NSData *)data
{
dispatch_block_t block = ^{ @autoreleasepool {

int result = xmlParseChunk(parserCtxt, (const char *)[data bytes], (int)[data length], 0);
int result = xmlParseChunk(self->parserCtxt, (const char *)[data bytes], (int)[data length], 0);

if (result == 0)
{
if (delegateQueue && [delegate respondsToSelector:@selector(xmppParserDidParseData:)])
if (self->delegateQueue && [self->delegate respondsToSelector:@selector(xmppParserDidParseData:)])
{
__strong id theDelegate = delegate;
__strong id theDelegate = self->delegate;

dispatch_async(delegateQueue, ^{ @autoreleasepool {
dispatch_async(self->delegateQueue, ^{ @autoreleasepool {

[theDelegate xmppParserDidParseData:self];
}});
}
}
else
{
if (delegateQueue && [delegate respondsToSelector:@selector(xmppParser:didFail:)])
if (self->delegateQueue && [self->delegate respondsToSelector:@selector(xmppParser:didFail:)])
{
NSError *error;

xmlError *xmlErr = xmlCtxtGetLastError(parserCtxt);
xmlError *xmlErr = xmlCtxtGetLastError(self->parserCtxt);

if (xmlErr->message)
{
Expand All @@ -846,9 +846,9 @@ - (void)parseData:(NSData *)data
error = [NSError errorWithDomain:@"libxmlErrorDomain" code:xmlErr->code userInfo:nil];
}

__strong id theDelegate = delegate;
__strong id theDelegate = self->delegate;

dispatch_async(delegateQueue, ^{ @autoreleasepool {
dispatch_async(self->delegateQueue, ^{ @autoreleasepool {

[theDelegate xmppParser:self didFail:error];
}});
Expand Down
Loading

0 comments on commit 2199643

Please sign in to comment.