From 658256185f15819afb85889e48fa035f84a18f71 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 11 Nov 2024 18:38:49 -0500 Subject: [PATCH] Fix crash when running multiple clients on Windows. The logic in `hsFILELock::ILock()` is incorrect on Win32. We should only fail immediately if we are *not* blocking. As it stands, running multiple clients can cause the lock to fail, resulting in an uncaught exception being thrown. --- Sources/Plasma/CoreLib/hsFILELock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/CoreLib/hsFILELock.cpp b/Sources/Plasma/CoreLib/hsFILELock.cpp index 9733b774b0..e81c9894f2 100644 --- a/Sources/Plasma/CoreLib/hsFILELock.cpp +++ b/Sources/Plasma/CoreLib/hsFILELock.cpp @@ -61,7 +61,7 @@ bool hsFILELock::ILock(bool block) const #ifdef HS_BUILD_FOR_WIN32 OVERLAPPED o{}; DWORD flags = LOCKFILE_EXCLUSIVE_LOCK; - if (block) + if (!block) flags |= LOCKFILE_FAIL_IMMEDIATELY; // Lock only the first byte of the file - we have