mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
Crash fix for ResourceCache::getResource()
A wrong 'read' locker is used around a critical section that actually modifies the _resources QHash. This can result in memory corruption and seg faults.
This commit is contained in:
parent
2b90d841b7
commit
654b5775e1
1 changed files with 1 additions and 1 deletions
|
@ -346,7 +346,7 @@ void ResourceCache::setRequestLimit(uint32_t limit) {
|
||||||
QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl& fallback, void* extra, size_t extraHash) {
|
QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl& fallback, void* extra, size_t extraHash) {
|
||||||
QSharedPointer<Resource> resource;
|
QSharedPointer<Resource> resource;
|
||||||
{
|
{
|
||||||
QReadLocker locker(&_resourcesLock);
|
QWriteLocker locker(&_resourcesLock);
|
||||||
auto& resourcesWithExtraHash = _resources[url];
|
auto& resourcesWithExtraHash = _resources[url];
|
||||||
auto resourcesWithExtraHashIter = resourcesWithExtraHash.find(extraHash);
|
auto resourcesWithExtraHashIter = resourcesWithExtraHash.find(extraHash);
|
||||||
if (resourcesWithExtraHashIter != resourcesWithExtraHash.end()) {
|
if (resourcesWithExtraHashIter != resourcesWithExtraHash.end()) {
|
||||||
|
|
Loading…
Reference in a new issue