Do not capture self in operations in categories
This commit is contained in:
parent
10c44577f6
commit
82faab82d3
|
@ -46,11 +46,14 @@ static char operationKey;
|
|||
|
||||
if (url)
|
||||
{
|
||||
__weak MKAnnotationView *wself = self;
|
||||
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished)
|
||||
{
|
||||
__strong MKAnnotationView *sself = wself;
|
||||
if (!sself) return;
|
||||
if (image)
|
||||
{
|
||||
self.image = image;
|
||||
sself.image = image;
|
||||
}
|
||||
if (completedBlock && finished)
|
||||
{
|
||||
|
|
|
@ -45,11 +45,14 @@ static char operationKey;
|
|||
|
||||
if (url)
|
||||
{
|
||||
__weak UIButton *wself = self;
|
||||
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
|
||||
{
|
||||
__strong UIButton *sself = wself;
|
||||
if (!sself) return;
|
||||
if (image)
|
||||
{
|
||||
[self setImage:image forState:state];
|
||||
[sself setImage:image forState:state];
|
||||
}
|
||||
if (completedBlock && finished)
|
||||
{
|
||||
|
@ -93,11 +96,14 @@ static char operationKey;
|
|||
|
||||
if (url)
|
||||
{
|
||||
__weak UIButton *wself = self;
|
||||
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
|
||||
{
|
||||
__strong UIButton *sself = wself;
|
||||
if (!sself) return;
|
||||
if (image)
|
||||
{
|
||||
[self setBackgroundImage:image forState:state];
|
||||
[sself setBackgroundImage:image forState:state];
|
||||
}
|
||||
if (completedBlock && finished)
|
||||
{
|
||||
|
|
|
@ -51,12 +51,15 @@ static char operationKey;
|
|||
|
||||
if (url)
|
||||
{
|
||||
__weak UIImageView *wself = self;
|
||||
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
|
||||
{
|
||||
__strong UIImageView *sself = wself;
|
||||
if (!sself) return;
|
||||
if (image)
|
||||
{
|
||||
self.image = image;
|
||||
[self setNeedsLayout];
|
||||
sself.image = image;
|
||||
[sself setNeedsLayout];
|
||||
}
|
||||
if (completedBlock && finished)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue