Fix MSVC mutex initialization with older host runtimes - #2354
Merged
doug-walker merged 2 commits intoSep 29, 2026
Merged
doug-walker merged 2 commits into
doug-walker merged 2 commits into
Conversation
Disable constexpr mutex construction for MSVC builds, following OIIO's workaround for crashes with older runtimes bundled by host applications. Signed-off-by: Zach Lewis <zachcanbereached@gmail.com>
remia
approved these changes
Sep 29, 2026
Collaborator
|
This is great please just disclose ai tool use with “assisted by: tool / model” in the pr body if you used one :) |
Collaborator
Author
|
Oh lordy, I didn't realize I hadn't done that. Shame on me! |
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.
OCIO built with recent MSVC toolchains may crash when a host application supplies an older MSVC runtime. The newer
constexprmutex constructor skips the runtime initialization that older runtimes expect before locking. This is suspected to cause the OCIO initialization crash reported in OIIO #5493 and discussed on OIIO #5504.Define
_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTORin OCIO's shared MSVC compiler settings, following OIIO #4914, which addressed OIIO #4641. This restores runtime mutex initialization throughout the build, including the internalMutexwrapper and directstd::mutexuses.Validation:
git diff --checkpassed.The Windows/Nuke reproduction and compatibility with an older MSVC runtime have not been tested locally.
--
Assisted-by: OpenAI Codex (GPT-6 Sol)