Repository navigation
VFS hooks: the guard keeps the thread's last error - #92
Merged
Merged
Conversation
The hooks' re-entrancy guard is a thread_local. In a build with the GNU toolchain (x86_64-pc-windows-gnu) a thread_local access goes through TlsGetValue, which sets the thread's last error to 0. The guard is dropped after the original function has returned, so a failing call came back with GetLastError() == 0: std::fs::create_dir_all on an existing directory then fails with "Success. (os error 0)" and no title loads. The drop now saves the last error and puts it back. MSVC builds use static TLS and are not affected either way. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Collaborator
|
Merged – a no-op for MSVC builds as you say, and correct for the GNU toolchain. Checked on Windows 11 with an RX 9070 (RDNA4, MSVC build): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hooks' re-entrancy guard is a
thread_local. In a build with the GNU toolchain (x86_64-pc-windows-gnu) athread_localaccess goes throughTlsGetValue, which sets the thread's last error to 0. The guard is dropped after the original function has returned, so a failing call came back withGetLastError() == 0.The visible effect:
std::fs::create_dir_allon a directory that already exists fails withSuccess. (os error 0), and no title loads:The drop now saves the last error and puts it back. MSVC builds use static TLS and are not affected either way.
Validation
Linux, Wine with vkd3d-proton, GNU toolchain build,
mainat1f82be3:xcl run <testgame> -- --hello)main+ the other Wine fix (#93) onlymain+ this change + #93[PASS], 2[FAIL]on an AMD iGPU (RADV) and on an RTX 5060 TiThe two failing checks are not about this change (
xmemworking-set statistics; the console window "not cloaked" under Wine). The run needs a locally patched vkd3d-proton for reasons that have nothing to do with this change either (it asserts on objects whose vtable XCL replaced); that is a separate topic. Not run on Windows.AI-assisted.
🤖 Generated with Claude Code