diff --git a/src/LiveSDK/Library/Internal/LiveConnectClientCore.m b/src/LiveSDK/Library/Internal/LiveConnectClientCore.m index e3932e6..d47a814 100755 --- a/src/LiveSDK/Library/Internal/LiveConnectClientCore.m +++ b/src/LiveSDK/Library/Internal/LiveConnectClientCore.m @@ -136,12 +136,13 @@ - (void) refreshSessionWithDelegate:(id)delegate if ([LiveAuthHelper shouldRefreshToken:_session refreshToken:_storage.refreshToken]) { - authRefreshRequest = [[LiveAuthRefreshRequest alloc] initWithClientId:_clientId - scope:_scopes - refreshToken:_storage.refreshToken - delegate:delegate - userState:userState - clientStub:self]; + authRefreshRequest = [[[LiveAuthRefreshRequest alloc] initWithClientId:_clientId + scope:_scopes + refreshToken:_storage.refreshToken + delegate:delegate + userState:userState + clientStub:self] + autorelease]; [authRefreshRequest execute]; } diff --git a/src/LiveSDK/Library/Internal/LiveDownloadOperationCore.m b/src/LiveSDK/Library/Internal/LiveDownloadOperationCore.m index 7a681a9..084007b 100644 --- a/src/LiveSDK/Library/Internal/LiveDownloadOperationCore.m +++ b/src/LiveSDK/Library/Internal/LiveDownloadOperationCore.m @@ -76,6 +76,11 @@ - (void) operationCompleted [self.delegate liveOperationSucceeded:self.publicOperation]; } + // LiveOperation was returned in the interface return. However, the app may not retain the object + // In order to keep it alive, we keep LiveOperationCore and LiveOperation in circular reference. + // After the event raised, we set this property to nil to break the circle, so that they are recycled. + self.publicOperation = nil; + self.completed = YES; } } diff --git a/src/LiveSDK/Library/Internal/LiveOperationCore.m b/src/LiveSDK/Library/Internal/LiveOperationCore.m index 2fcd536..f7ba480 100755 --- a/src/LiveSDK/Library/Internal/LiveOperationCore.m +++ b/src/LiveSDK/Library/Internal/LiveOperationCore.m @@ -227,12 +227,12 @@ - (void) operationFailed:(NSError *)error if ([_delegate respondsToSelector:@selector(liveOperationFailed:operation:)]) { [_delegate liveOperationFailed:error operation:publicOperation]; - - // LiveOperation was returned in the interface return. However, the app may not retain the object - // In order to keep it alive, we keep LiveOperationCore and LiveOperation in circular reference. - // After the event raised, we set this property to nil to break the circle, so that they are recycled. - self.publicOperation = nil; } + + // LiveOperation was returned in the interface return. However, the app may not retain the object + // In order to keep it alive, we keep LiveOperationCore and LiveOperation in circular reference. + // After the event raised, we set this property to nil to break the circle, so that they are recycled. + self.publicOperation = nil; } - (void) operationCompleted @@ -264,11 +264,12 @@ - (void) operationCompleted if ([_delegate respondsToSelector:@selector(liveOperationSucceeded:)]) { [_delegate liveOperationSucceeded:self.publicOperation]; - // LiveOperation was returned in the interface return. However, the app may not retain the object - // In order to keep it alive, we keep LiveOperationCore and LiveOperation in circular reference. - // After the event raised, we set this property to nil to break the circle, so that they are recycled. - self.publicOperation = nil; } + + // LiveOperation was returned in the interface return. However, the app may not retain the object + // In order to keep it alive, we keep LiveOperationCore and LiveOperation in circular reference. + // After the event raised, we set this property to nil to break the circle, so that they are recycled. + self.publicOperation = nil; } else {