Core/Vmaps: Fixed use after free and deadlocks when loading a model file fails

This commit is contained in:
Shauren
2024-07-06 22:52:11 +02:00
parent 518fe1fd1e
commit d05dbaaecb
5 changed files with 35 additions and 38 deletions

View File

@@ -100,7 +100,6 @@ namespace VMAP
threadPool.PostWork([this, file = directoryEntry.path(), &abortThreads, &workerIndexGen, &spawnedModelFilesByThread, &mapsToProcess]
{
thread_local std::size_t workerIndex = workerIndexGen++;
--mapsToProcess;
auto dirf = OpenFile(file, "rb");
if (!dirf)
@@ -127,6 +126,7 @@ namespace VMAP
return abortThreads();
spawnedModelFilesByThread[workerIndex].merge(data.SpawnedModelFiles);
--mapsToProcess;
});
}