Skip to content

Commit

Permalink
Fix crash when running multiple clients on Windows.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Hoikas committed Nov 11, 2024
1 parent 06e46e4 commit 6582561
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Plasma/CoreLib/hsFILELock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6582561

Please sign in to comment.