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:
Sebastien Pouliot 2013-04-08 16:47:20 -04:00
Родитель c366b0e0bd
Коммит 28425260ba
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -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);
}
});
}
}
}