mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
NSURLSession: call getTasks callbacks on delegate queue
Matches the documented behavior.
This commit is contained in:
parent
3c27683c03
commit
c0a6227013
1 changed files with 11 additions and 4 deletions
|
@ -243,7 +243,8 @@ static unsigned nextSessionIdentifier()
|
|||
void (^invalidateSessionCallback)(void) =
|
||||
^{
|
||||
if (nil == _delegate) return;
|
||||
[self.delegateQueue addOperationWithBlock:
|
||||
|
||||
[[self delegateQueue] addOperationWithBlock:
|
||||
^{
|
||||
if ([_delegate respondsToSelector: @selector(URLSession:didBecomeInvalidWithError:)])
|
||||
{
|
||||
|
@ -287,7 +288,7 @@ static unsigned nextSessionIdentifier()
|
|||
return;
|
||||
}
|
||||
|
||||
[_delegateQueue addOperationWithBlock:
|
||||
[[self delegateQueue] addOperationWithBlock:
|
||||
^{
|
||||
if ([_delegate respondsToSelector: @selector(URLSession:didBecomeInvalidWithError:)])
|
||||
{
|
||||
|
@ -394,14 +395,20 @@ static unsigned nextSessionIdentifier()
|
|||
return [task isKindOfClass:[NSURLSessionDownloadTask class]];
|
||||
}]];
|
||||
|
||||
completionHandler(dataTasks, uploadTasks, downloadTasks);
|
||||
[[self delegateQueue] addOperationWithBlock:
|
||||
^{
|
||||
completionHandler(dataTasks, uploadTasks, downloadTasks);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void) getAllTasksWithCompletionHandler: (void (^)(GS_GENERIC_CLASS(NSArray, __kindof NSURLSessionTask*) *tasks))completionHandler
|
||||
{
|
||||
NSArray *allTasks = [_taskRegistry allTasks];
|
||||
|
||||
completionHandler(allTasks);
|
||||
[[self delegateQueue] addOperationWithBlock:
|
||||
^{
|
||||
completionHandler(allTasks);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void) addTask: (NSURLSessionTask*)task
|
||||
|
|
Loading…
Reference in a new issue