Merge pull request #29 from nonamelive/patch-1

Fixed a potential crash when the delegate retainCount = 1, which means th
This commit is contained in:
Olivier Poitrey 2011-10-03 07:18:06 -07:00
commit 4792909c5b
1 changed files with 2 additions and 2 deletions

View File

@ -197,7 +197,7 @@ static SDWebImageManager *instance;
SDWebImageDownloader *aDownloader = [downloaders objectAtIndex:uidx];
if (aDownloader == downloader)
{
id<SDWebImageManagerDelegate> delegate = [downloadDelegates objectAtIndex:uidx];
id<SDWebImageManagerDelegate> delegate = [[[downloadDelegates objectAtIndex:uidx] retain] autorelease];
if (image)
{
@ -251,7 +251,7 @@ static SDWebImageManager *instance;
SDWebImageDownloader *aDownloader = [downloaders objectAtIndex:uidx];
if (aDownloader == downloader)
{
id<SDWebImageManagerDelegate> delegate = [downloadDelegates objectAtIndex:uidx];
id<SDWebImageManagerDelegate> delegate = [[[downloadDelegates objectAtIndex:uidx] retain] autorelease];
if ([delegate respondsToSelector:@selector(webImageManager:didFailWithError:)])
{