Lock linker mutex in RelocateAnyImports (#3693)

Module relocation is not thread safe, games calling LoadAndStartModule on multiple threads can invalidate pointers while iterating through m_modules.

This fixes crashes in some apps on Windows.
This commit is contained in:
Stephen Miller
2025-10-01 14:27:12 -05:00
committed by GitHub
parent 1020c3150f
commit af147debc6

View File

@@ -111,6 +111,8 @@ public:
}
void RelocateAnyImports(Module* m) {
std::scoped_lock lk{mutex};
Relocate(m);
const auto exports = m->GetExportModules();
for (auto& export_mod : exports) {