Skip to content

bugfix(audio): Copy sound scene state safely - #3247

Open
CryoTheRenegade wants to merge 1 commit into
TheSuperHackers:mainfrom
CryoTheRenegade:bugfix/clang-tidy-soundscene-copy
Open

bugfix(audio): Copy sound scene state safely#3247
CryoTheRenegade wants to merge 1 commit into
TheSuperHackers:mainfrom
CryoTheRenegade:bugfix/clang-tidy-soundscene-copy

Conversation

@CryoTheRenegade

Copy link
Copy Markdown

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

@CryoTheRenegade
CryoTheRenegade marked this pull request as ready for review September 13, 2026 15:08
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Copy sound scene attachment state safely

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• 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.

Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp

@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown

Greptile Summary

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.

Important Files Changed

Filename Overview
Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp Reworks sound-scene object copying to preserve equivalent state while avoiding a pure virtual positioning call during construction.

Reviews (1): Last reviewed commit: "bugfix(audio): Copy sound scene state sa..." | Re-trigger Greptile

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant