Repository navigation
state_exec: stabilize document_scope typed-slot identity across DLL boundaries (fixes Windows cvcgl_stream_bind) - #539
Merged
Conversation
…LL boundaries document_scope::slot<T>(key) guards against a key being reused with a different T via an RTTI-free per-type tag. That tag was the address of a function-local `static const char` — unique per instantiated T WITHIN a module, but NOT merged across shared libraries on Windows (libcvc.dll vs cvcGL.dll each get their own copy). So a slot created in one module read back as a tag MISMATCH (nullptr) in another, even for the same T. This made cvcgl_stream_bind fail on Windows only (package-windows / libcvc-release): the test publishes a mock StreamBindingSink into the document_scope from the test TU and the gl-bind-stream verb (in cvcGL) reads it back; on Windows the tag mismatch returned nullptr, the verb took its "no GL sink" error branch, ok=false, and the Release assert() fail-fasted (exit 0xc0000409). Linux/macOS merge the static across .so boundaries, so the addresses coincided and it passed — hiding the defect (the package-windows lane is not a required check). Fix: derive the type tag from the compiler's function-signature macro (__FUNCSIG__ / __PRETTY_FUNCTION__), which embeds T's name, and compare tags by CONTENT (std::strcmp) rather than by address. The same T yields a byte-identical string in every TU and every module, so the identity is stable across DLLs while staying RTTI-free; distinct Ts still have distinct signatures, so the reused-key guard is preserved. Fixes the real cross-module seam (a sink published and read across libcvc<->cvcGL), not just the test. Verified cvcgl_stream_bind + stream_test green on Linux; Windows greens via CI.
transfix
enabled auto-merge
October 2, 2026 14:34
transfix
added a commit
that referenced
this pull request
Oct 2, 2026
transfix
added a commit
that referenced
this pull request
Oct 2, 2026
transfix
added a commit
that referenced
this pull request
Oct 2, 2026
transfix
added a commit
that referenced
this pull request
Oct 2, 2026
transfix
added a commit
that referenced
this pull request
Oct 2, 2026
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.
Fixes master red on Windows.
cvcgl_stream_bindfails in thepackage-windows / libcvc-releaselane (assert(get(app,"t1.ok")=="true")atcvcgl_stream_bind.cpp:69, exit0xc0000409= MSVC Releaseassertfail-fast). Windows-only; Linux/macOS pass. It arrived with the stream merges and is red on master and every open PR.Root cause:
document_scope::slot<T>(key)(added in #524) guards a key against reuse with a differentTvia an RTTI-free per-type tag — which was the address of a function-localstatic const char. That address is unique perTwithin a module but is not merged across shared libraries on Windows (libcvc.dll vs cvcGL.dll each hold their own copy). So a slot created in one module reads back as a tag mismatch → nullptr in another, for the sameT. The test publishes a mockStreamBindingSinkinto the document scope from the test TU and thegl-bind-streamverb (in cvcGL) reads it back; on Windows the mismatch made the verb take its "no GL sink" branch →ok=false→ the assert fail-fasted. Linux/macOS merge the static across.soboundaries so the addresses coincided and it passed — hiding the defect (the lane isn't a required check).Fix: derive the tag from the compiler's function-signature macro (
__FUNCSIG__/__PRETTY_FUNCTION__, which embedsT's name) and compare tags by content (std::strcmp) instead of by address. The sameTyields a byte-identical string in every TU and module, so the identity is stable across DLLs while staying RTTI-free; distinctTs still have distinct signatures, so the reused-key guard is preserved. This fixes the real cross-module seam (a sink published in cvcGL and read across the libcvc↔cvcGL boundary), not just the test.Verified:
cvcgl_stream_bindand the fullstream_test(33/33) green on Linux; the Windows lane greens via CI. No behavior change on the matching path.