summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Assets/CustomAsset.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-06-05 23:32:02 +0200
committerGitHub <noreply@github.com>2023-06-05 23:32:02 +0200
commit678db26f684edaac7c0ea699f2ac2b4771e31993 (patch)
treea766e794f51250d81d6d44e169eb716bd2579115 /Source/Core/VideoCommon/Assets/CustomAsset.cpp
parentce2b63dcc086f95c7278827a079f007faa7f34ad (diff)
parent9d7ab477387bb9afc00181dfa70e1e0d1a27b28b (diff)
Merge pull request #11891 from iwubcode/asset_thread_safety
VideoCommon: add additional locks around asset access / usage
Diffstat (limited to 'Source/Core/VideoCommon/Assets/CustomAsset.cpp')
-rw-r--r--Source/Core/VideoCommon/Assets/CustomAsset.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/Assets/CustomAsset.cpp b/Source/Core/VideoCommon/Assets/CustomAsset.cpp
index 545b60e093..1591f93f91 100644
--- a/Source/Core/VideoCommon/Assets/CustomAsset.cpp
+++ b/Source/Core/VideoCommon/Assets/CustomAsset.cpp
@@ -16,6 +16,7 @@ bool CustomAsset::Load()
const auto load_information = LoadImpl(m_asset_id);
if (load_information.m_bytes_loaded > 0)
{
+ std::lock_guard lk(m_info_lock);
m_bytes_loaded = load_information.m_bytes_loaded;
m_last_loaded_time = load_information.m_load_time;
}
@@ -29,6 +30,7 @@ CustomAssetLibrary::TimeType CustomAsset::GetLastWriteTime() const
const CustomAssetLibrary::TimeType& CustomAsset::GetLastLoadedTime() const
{
+ std::lock_guard lk(m_info_lock);
return m_last_loaded_time;
}
@@ -39,6 +41,7 @@ const CustomAssetLibrary::AssetID& CustomAsset::GetAssetId() const
std::size_t CustomAsset::GetByteSizeInMemory() const
{
+ std::lock_guard lk(m_info_lock);
return m_bytes_loaded;
}