fix: workaround for destruction order issue

which creates empty files with random name on Linux

fix: https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/5255
This commit is contained in:
Horror Proton
2023-06-26 23:49:32 +08:00
parent cae4070997
commit ee8204c51a
3 changed files with 13 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ void asst::ResourceLoader::add_load_queue(AbstractResource& res, const std::file
m_load_cv.notify_all();
}
asst::ResourceLoader::~ResourceLoader()
void asst::ResourceLoader::cancel()
{
m_load_thread_exit = true;
@@ -71,6 +71,11 @@ asst::ResourceLoader::~ResourceLoader()
}
}
asst::ResourceLoader::~ResourceLoader()
{
cancel();
}
bool asst::ResourceLoader::load(const std::filesystem::path& path)
{
if (!std::filesystem::exists(path)) {