module: define Attribute::uuid() out-of-line so its any_cast cannot mismatch - #322
Open
jhery-rdo wants to merge 1 commit into
Open
Conversation
…ismatch
Attribute::uuid() was defined inline in attribute.hpp, so every image that
included the header got its own instantiation of get_role_data<utility::Uuid>()
and with it its own std::any_cast<Uuid> call site.
std::any_cast matches on type_info identity, not on type name, and typeinfo for
xstudio::utility::Uuid is emitted privately into each image rather than exported
from a single library. A plugin's typeid(Uuid) is therefore a different object
from the one libmodule used when Attribute's constructor stored the UuidRole
data, and the cast throws bad_any_cast even though both sides are the same type.
Reproduced on macOS (Apple Silicon, 1.3.0) with a Blackmagic DeckLink card and
Desktop Video installed. BMDecklinkPlugin::attribute_changed() compares the
incoming uuid against resolutions_->uuid(), start_stop_->uuid() and nine others;
the first of those calls during plugin construction throws:
AttributeData::get() [T = xstudio::utility::Uuid] Attempt to get
AttributeData with type N7xstudio7utility4UuidE as type
N7xstudio7utility4UuidE
StudioUI::loadVideoOutputPlugin(...) error("bad any cast")
Spawn fails, so initialise() never runs, so the
register_viewport_dockable_widget() call that creates the SDI output button
never happens. The button is simply absent from the toolbar, and nothing in the
default log points at the cause.
Defining uuid() in attribute.cpp means the cast is instantiated exactly once, in
the same image that wrote the role data, so it cannot mismatch regardless of a
plugin's visibility flags or the toolchain's RTTI emission.
Attribute::operator==(const Attribute &) and operator==(const utility::Uuid &)
both call uuid() and are fixed by the same change.
Other in-tree plugins call Attribute::uuid() from their own translation units
too, so this is not specific to the DeckLink plugin -- that is just the one that
calls it during construction and therefore hits it every time.
Verified on the affected machine: the SDI output button is back.
jhery-rdo
force-pushed
the
fix/attribute-uuid-out-of-line-upstream
branch
from
August 19, 2026 21:14
9b7f154 to
2b18a25
Compare
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.
Attribute::uuid()was defined inline inattribute.hpp, so every image that included the header got its own instantiation ofget_role_data<utility::Uuid>()and with it its ownstd::any_cast<Uuid>call site.std::any_castmatches ontype_infoidentity, not on type name, and typeinfo forxstudio::utility::Uuidis emitted privately into each image rather than exported from a single library. A plugin'stypeid(Uuid)is therefore a different object from the onelibmoduleused whenAttribute's constructor stored theUuidRoledata, and the cast throwsbad_any_casteven though both sides are the same type.Reproduced on macOS (Apple Silicon, 1.3.0) with a Blackmagic DeckLink card and Desktop Video installed.
BMDecklinkPlugin::attribute_changed()compares the incoming uuid againstresolutions_->uuid(),start_stop_->uuid()and nine others; the first of those calls during plugin construction throws:Spawn fails, so
initialise()never runs, so theregister_viewport_dockable_widget()call that creates the SDI output button never happens. The button is simply absent from the toolbar, and nothing in the default log points at the cause.Defining
uuid()inattribute.cppmeans the cast is instantiated exactly once, in the same image that wrote the role data, so it cannot mismatch regardless of a plugin's visibility flags or the toolchain's RTTI emission.Attribute::operator==(const Attribute &)andoperator==(const utility::Uuid &)both calluuid()and are fixed by the same change.Other in-tree plugins call
Attribute::uuid()from their own translation units too, so this is not specific to the DeckLink plugin -- that is just the one that calls it during construction and therefore hits it every time.