made caller/concurrent rules tighter

This commit is contained in:
fourtf
2019-08-20 23:29:11 +02:00
parent 7d842e6cf7
commit 14222f84f2
9 changed files with 36 additions and 15 deletions
+8 -1
View File
@@ -50,7 +50,11 @@ NetworkRequest NetworkRequest::type(NetworkRequestType newRequestType) &&
NetworkRequest NetworkRequest::caller(const QObject *caller) &&
{
this->data->caller_ = caller;
// Caller must be in gui thread
assert(caller->thread() == qApp->thread());
this->data->caller_ = const_cast<QObject *>(caller);
this->data->hasCaller_ = true;
return std::move(*this);
}
@@ -144,6 +148,9 @@ void NetworkRequest::execute()
this->data->useQuickLoadCache_ = false;
}
// Can not have a caller and be concurrent at the same time.
assert(!(this->data->caller_ && this->data->executeConcurrently));
load(std::move(this->data));
}