зеркало из https://github.com/xamarin/ios-samples.git
It turns out AsJPEG (like AsPNG) are not thread-safe and must be executed from the main/UI thread. Fix bug #11583
This commit is contained in:
Родитель
c366b0e0bd
Коммит
28425260ba
|
@ -58,11 +58,13 @@ namespace ImageProtocol
|
|||
var value = Request.Url.Path.Substring (1);
|
||||
using (var image = Render (value)) {
|
||||
using (var response = new NSUrlResponse (Request.Url, "image/jpeg", -1, null)) {
|
||||
using (var data = image.AsJPEG ()) {
|
||||
Client.ReceivedResponse (this, response, NSUrlCacheStoragePolicy.NotAllowed);
|
||||
Client.DataLoaded (this, data);
|
||||
Client.ReceivedResponse (this, response, NSUrlCacheStoragePolicy.NotAllowed);
|
||||
this.InvokeOnMainThread (delegate {
|
||||
using (var data = image.AsJPEG ()) {
|
||||
Client.DataLoaded (this, data);
|
||||
}
|
||||
Client.FinishedLoading (this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче