mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +02:00
Merge pull request #12265 from SamGondelman/resourceCache
Remove unnecessary invokeMethod from ResourceCache::getResource
This commit is contained in:
commit
9a131cfab6
1 changed files with 1 additions and 8 deletions
|
@ -340,14 +340,6 @@ QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl&
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
qCDebug(networking) << "Fetching asynchronously:" << url;
|
|
||||||
QMetaObject::invokeMethod(this, "getResource",
|
|
||||||
Q_ARG(QUrl, url), Q_ARG(QUrl, fallback));
|
|
||||||
// Cannot use extra parameter as it might be freed before the invocation
|
|
||||||
return QSharedPointer<Resource>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!url.isValid() && !url.isEmpty() && fallback.isValid()) {
|
if (!url.isValid() && !url.isEmpty() && fallback.isValid()) {
|
||||||
return getResource(fallback, QUrl());
|
return getResource(fallback, QUrl());
|
||||||
}
|
}
|
||||||
|
@ -358,6 +350,7 @@ QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl&
|
||||||
extra);
|
extra);
|
||||||
resource->setSelf(resource);
|
resource->setSelf(resource);
|
||||||
resource->setCache(this);
|
resource->setCache(this);
|
||||||
|
resource->moveToThread(qApp->thread());
|
||||||
connect(resource.data(), &Resource::updateSize, this, &ResourceCache::updateTotalSize);
|
connect(resource.data(), &Resource::updateSize, this, &ResourceCache::updateTotalSize);
|
||||||
{
|
{
|
||||||
QWriteLocker locker(&_resourcesLock);
|
QWriteLocker locker(&_resourcesLock);
|
||||||
|
|
Loading…
Reference in a new issue