mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-05 21:33:54 +02:00
fix resource crash
This commit is contained in:
parent
cc9a3e2541
commit
884a64bfa6
1 changed files with 13 additions and 10 deletions
|
@ -353,16 +353,19 @@ QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl&
|
||||||
// We've seen this extra info before
|
// We've seen this extra info before
|
||||||
resource = resourcesWithExtraHashIter.value().lock();
|
resource = resourcesWithExtraHashIter.value().lock();
|
||||||
} else if (resourcesWithExtraHash.size() > 0.0f) {
|
} else if (resourcesWithExtraHash.size() > 0.0f) {
|
||||||
// We haven't seen this extra info before, but we've already downloaded the resource. We need a new copy of this object (with any old hash).
|
auto oldResource = resourcesWithExtraHash.begin().value().lock();
|
||||||
resource = createResourceCopy(resourcesWithExtraHash.begin().value().lock());
|
if (oldResource) {
|
||||||
resource->setExtra(extra);
|
// We haven't seen this extra info before, but we've already downloaded the resource. We need a new copy of this object (with any old hash).
|
||||||
resource->setExtraHash(extraHash);
|
resource = createResourceCopy(oldResource);
|
||||||
resource->setSelf(resource);
|
resource->setExtra(extra);
|
||||||
resource->setCache(this);
|
resource->setExtraHash(extraHash);
|
||||||
resource->moveToThread(qApp->thread());
|
resource->setSelf(resource);
|
||||||
connect(resource.data(), &Resource::updateSize, this, &ResourceCache::updateTotalSize);
|
resource->setCache(this);
|
||||||
resourcesWithExtraHash.insert(extraHash, resource);
|
resource->moveToThread(qApp->thread());
|
||||||
resource->ensureLoading();
|
connect(resource.data(), &Resource::updateSize, this, &ResourceCache::updateTotalSize);
|
||||||
|
resourcesWithExtraHash.insert(extraHash, resource);
|
||||||
|
resource->ensureLoading();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resource) {
|
if (resource) {
|
||||||
|
|
Loading…
Reference in a new issue