1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 09:09:40 +00:00

Avoid possible race condition on NIFFile::sLoadUnsupportedFiles

Its value is written from the main thread but other threads read it.
This commit is contained in:
elsid 2022-02-11 21:36:08 +01:00
parent fbd95516f4
commit 283b68025c
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
2 changed files with 3 additions and 2 deletions

View file

@ -344,7 +344,7 @@ bool NIFFile::getUseSkinning() const
return mUseSkinning;
}
bool NIFFile::sLoadUnsupportedFiles = false;
std::atomic_bool NIFFile::sLoadUnsupportedFiles = false;
void NIFFile::setLoadUnsupportedFiles(bool load)
{

View file

@ -5,6 +5,7 @@
#include <stdexcept>
#include <vector>
#include <atomic>
#include <components/debug/debuglog.hpp>
#include <components/files/constrainedfilestream.hpp>
@ -65,7 +66,7 @@ class NIFFile final : public File
bool mUseSkinning = false;
static bool sLoadUnsupportedFiles;
static std::atomic_bool sLoadUnsupportedFiles;
/// Parse the file
void parse(Files::IStreamPtr stream);