Skip to content

fixed thread race in SoundTrackWriter#32980

Open
igorkorsukov wants to merge 1 commit intomusescore:masterfrom
igorkorsukov:w/audio/export_threads
Open

fixed thread race in SoundTrackWriter#32980
igorkorsukov wants to merge 1 commit intomusescore:masterfrom
igorkorsukov:w/audio/export_threads

Conversation

@igorkorsukov
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d6684f8d-ce61-4206-94e3-8733f926470c

📥 Commits

Reviewing files that changed from the base of the PR and between 6b6ff42 and a4c456c.

📒 Files selected for processing (1)
  • src/framework/audio/engine/internal/export/soundtrackwriter.cpp

📝 Walkthrough

Walkthrough

In SoundTrackWriter::write(), the deferred cleanup no longer calls the audio engine and source setters directly. Teardown actions—setting render mode to IdleMode, resetting the source output spec, and deactivating the source—are wrapped in an IAudioEngine::Operation lambda and executed via audioEngine()->execOperation(OperationType::LongOperation, func). m_isAborted is still reset prior to these teardown actions.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided. The repository's template requires a description with issue reference, motivation for changes, and completion of a checklist. Add a pull request description following the template: include the resolved issue number, brief explanation of the thread race problem and the fix, and complete the required checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fixed thread race in SoundTrackWriter' directly describes the main change: addressing a thread race condition in the SoundTrackWriter component by wrapping teardown actions in synchronized execOperation calls.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/framework/audio/engine/internal/export/soundtrackwriter.cpp`:
- Around line 107-117: Move the abort-flag reset so it occurs after the
synchronized teardown via execOperation: currently m_isAborted is cleared before
calling audioEngine()->execOperation, which can race with abort() and leak into
the next write(); instead clear m_isAborted only after execOperation completes
(i.e., after the lambda that calls audioEngine()->setMode(RenderMode::IdleMode),
m_source->setOutputSpec(...) and m_source->setIsActive(false) has finished
executing) so that the flag can't be re-set by abort() while the engine teardown
is in progress.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a85ef522-44c9-4758-80fa-c5deec734c2e

📥 Commits

Reviewing files that changed from the base of the PR and between 6f59207 and 6b6ff42.

📒 Files selected for processing (1)
  • src/framework/audio/engine/internal/export/soundtrackwriter.cpp

@igorkorsukov igorkorsukov force-pushed the w/audio/export_threads branch from 6b6ff42 to a4c456c Compare April 10, 2026 11:13
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