diff --git a/src/common/NetworkPrivate.cpp b/src/common/NetworkPrivate.cpp index e135d910b..e130dd8c1 100644 --- a/src/common/NetworkPrivate.cpp +++ b/src/common/NetworkPrivate.cpp @@ -135,8 +135,10 @@ void loadUncached(const std::shared_ptr &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 &data) { if (data->onError_) { - data->onError_(NetworkResult({}, reply->error())); + auto error = reply->error(); + postToThread([data, error] { + data->onError_(NetworkResult({}, error)); + }); } return; }