Skip to content

fix(audio): Copy SoundSceneObjClass state safely - #3247

Merged
xezon merged 2 commits into
TheSuperHackers:mainfrom
CryoTheRenegade:bugfix/clang-tidy-soundscene-copy
Sep 15, 2026
Merged

xezon merged 2 commits 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

This PR makes SoundSceneObjClass copying preserve scene, callback, attachment, event, and persistence state without invoking the derived assignment path during base construction.

  • Retains the attached render object directly, avoiding premature virtual positioning.
  • Initializes m_AttachedBone in the default constructor.
  • Gives copied sound objects a new sound ID and registers them normally.
  • Uses base copy construction for PersistClass state.

Confidence Score: 5/5

The PR appears safe to merge; no actionable new defects remain after the latest revision.

The revised constructor preserves the prior copied state while avoiding the unsafe assignment path, retains the attached object through the existing reference-count helper, and still assigns and registers a distinct sound-object ID.

Important Files Changed

Filename Overview
Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp Safely copies sound-scene state and attachment ownership without calling virtual positioning before derived construction completes.

Reviews (2): Last reviewed commit: "refactor(audio): Copy persistence state ..." | 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

Comment thread Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp Outdated
Comment thread Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp Outdated
@xezon xezon added Audio Is audio related Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Fix Is fixing something, but is not user facing labels Sep 14, 2026
@xezon xezon changed the title bugfix(audio): Copy sound scene state safely fix(audio): Copy sound scene state safely Sep 14, 2026
@CryoTheRenegade

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 9b8ff3f784

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@xezon xezon added the Stability Concerns stability of the runtime label Sep 14, 2026
@xezon xezon added this to the Stability fixes milestone Sep 14, 2026
@xezon xezon changed the title fix(audio): Copy sound scene state safely fix(audio): Copy SoundSceneObjClass state safely Sep 15, 2026
@xezon
xezon merged commit 887eee0 into TheSuperHackers:main Sep 15, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Audio Is audio related Fix Is fixing something, but is not user facing Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker Stability Concerns stability of the runtime ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants