Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ios
/
yh_sdwebimage
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
DreamPiggy
7 years ago
Commit
776ce2b85e41f23b521f435eb3821ef6ffa978d7
1 parent
71caeb82
Follow Apple's doc, add NSOperation only after all configuration done.
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
SDWebImage/SDWebImageDownloader.m
SDWebImage/SDWebImageDownloader.m
View file @
776ce2b
...
...
@@ -234,8 +234,7 @@
}
else
if
(
options
&
SDWebImageDownloaderLowPriority
)
{
operation
.
queuePriority
=
NSOperationQueuePriorityLow
;
}
[
sself
.
downloadQueue
addOperation
:
operation
]
;
if
(
sself
.
executionOrder
==
SDWebImageDownloaderLIFOExecutionOrder
)
{
// Emulate LIFO execution order by systematically adding new operations as last operation's dependency
[
sself
.
lastAddedOperation
addDependency
:
operation
]
;
...
...
@@ -289,6 +288,9 @@
UNLOCK
(
sself
.
operationsLock
);
};
[
self
.
URLOperations
setObject
:
operation
forKey
:
url
];
// Add operation to operation queue only after all configuration done according to Apple's doc.
// `addOperation:` does not synchronously execute the `operation.completionBlock` so this will not cause deadlock.
[
self
.
downloadQueue
addOperation
:
operation
];
}
UNLOCK
(
self
.
operationsLock
);
...
...
Please
register
or
login
to post a comment