Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1077 "Block implicity retains 'self'" warnings #1078

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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