NetworkRequests now executes error callback on gui thread

This commit is contained in:
fourtf 2020-08-13 18:15:40 +02:00
parent b1d9b55bf7
commit adbe92bd60

View file

@ -135,8 +135,10 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
reply->abort();
if (data->onError_)
{
data->onError_(
NetworkResult({}, NetworkResult::timedoutStatus));
postToThread([data] {
data->onError_(NetworkResult(
{}, NetworkResult::timedoutStatus));
});
}
});
}
@ -157,7 +159,10 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
{
if (data->onError_)
{
data->onError_(NetworkResult({}, reply->error()));
auto error = reply->error();
postToThread([data, error] {
data->onError_(NetworkResult({}, error));
});
}
return;
}