mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 22:50:57 +00:00
Fixed a concurrent modification error in caching app images
This commit is contained in:
@@ -50,21 +50,25 @@
|
||||
- (void) retrieveAssetForApp:(App*)app useCache:(BOOL)useCache {
|
||||
UIImage* appImage = nil;
|
||||
if (useCache) {
|
||||
@synchronized(_imageCache) {
|
||||
UIImage* cachedImage = [_imageCache objectForKey:app.appId];
|
||||
if (cachedImage != nil) {
|
||||
appImage = cachedImage;
|
||||
app.appImage = appImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (appImage == nil) {
|
||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:_host.address uniqueId:_uniqueId deviceName:deviceName cert:_cert];
|
||||
NSData* appAsset = [hMan executeRequestSynchronously:[hMan newAppAssetRequestWithAppId:app.appId]];
|
||||
appImage = [UIImage imageWithData:appAsset];
|
||||
app.appImage = appImage;
|
||||
if (appImage != nil) {
|
||||
@synchronized(_imageCache) {
|
||||
[_imageCache setObject:appImage forKey:app.appId];
|
||||
}
|
||||
}
|
||||
}
|
||||
[self performSelectorOnMainThread:@selector(sendCallBackForApp:) withObject:app waitUntilDone:NO];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user