You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevents a pure virtual call and possible crash when copying an attached sound object. The copy constructor now preserves attachment state without positioning the object before construction finishes.
• Initializes attachment bone state for newly created sound scene objects.
• Copies scene, callback, event, and attachment state without virtual positioning during
construction.
• Preserves persistence metadata and registration while preventing pure virtual calls.
Diagram
sequenceDiagram
actor Caller
participant CopyCtor as Sound copy constructor
participant Persist as Persistence base
participant Registry as Sound registry
Caller->>CopyCtor: Copy attached sound
Note over CopyCtor: Initialize state directly
CopyCtor->>Persist: Copy base state
Persist-->>CopyCtor: State copied
CopyCtor->>Registry: Register new object
Registry-->>CopyCtor: Registration complete
CopyCtor-->>Caller: Constructed copy
Loading
High-Level Assessment
The direct constructor initialization is the appropriate approach. Reusing the assignment operator would call Attach_To_Object, which applies automatic positioning and dispatches the pure virtual Set_Transform before the derived object is fully constructed. Directly retaining the attachment reference and copying the bone index preserves state without unsafe virtual dispatch, while normal assignment behavior remains unchanged for fully constructed objects.
Files changed (1) +9 / -4
Bug fix (1) +9 / -4
SoundSceneObj.cppSafely copy sound scene attachment state during construction+9/-4
Safely copy sound scene attachment state during construction
• Initializes the attachment bone in the default constructor. The copy constructor now directly copies scene, callback, event, bone, attachment-reference, and persistence state instead of delegating to assignment, avoiding virtual positioning before derived construction completes.
The PR safely preserves SoundSceneObjClass copy state without invoking attachment-driven virtual positioning during base construction.
Initializes the attachment bone to the established unattached sentinel.
Copies scene, callback, event, attachment, and persistence state previously copied through the assignment operator.
Retains unique sound-object ID allocation and global registration behavior.
Confidence Score: 5/5
The PR appears safe to merge, with no actionable regressions identified in the revised copy-construction path.
The replacement constructor preserves all state previously copied by SoundSceneObjClass::operator=, retains ownership and registration behavior, and removes the unsafe virtual positioning call.
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
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.
Prevents a pure virtual call and possible crash when copying an attached sound object. The copy constructor now preserves attachment state without positioning the object before construction finishes.
Found by clang-tidy