Skip to content

Fix crash in AudioUnit backend due to off-by-one error in parameter syncing#15919

Merged
daschuer merged 1 commit intomixxxdj:2.5from
xARSENICx:fix-audiounit-crash
Feb 3, 2026
Merged

Fix crash in AudioUnit backend due to off-by-one error in parameter syncing#15919
daschuer merged 1 commit intomixxxdj:2.5from
xARSENICx:fix-audiounit-crash

Conversation

@xARSENICx
Copy link
Copy Markdown
Contributor

Bug Description

Fixes a crash on macOS when using AudioUnit effects in a Debug build.
The syncParameters() method had an off-by-one error when growing the m_lastValues list.
When i=0 and the list is empty:

  • The check if (m_lastValues.size() < i) (0 < 0) evaluated to false.
  • The list did not grow.
  • Accessing m_lastValues[i] caused an index-out-of-bounds assertion failure.

Reproduction Steps

  1. Build Mixxx on macOS in Debug mode (-DCMAKE_BUILD_TYPE=Debug).
    • Note: The crash relies on Qt's container bounds assertions, which are often disabled in Release builds.
  2. Start Mixxx with a fresh configuration (or ensure an AudioUnit effect is instantiated).
  3. Load an AudioUnit effect into an effect chain (or trigger any action that instantiates AudioUnitEffectProcessor).
  4. Result: Mixxx crashes immediately with ASSERT failure in QList::operator[]: "index out of range".

The Fix

Changed the condition to if (m_lastValues.size() <= i) to ensure the list grows correctly when size == index.

Verification

Run this command on a Mac to verify the crash (before the fix) and the solution (after the fix):

# 1. Setup Debug Build
cmake -S . -B build_debug -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=...

# 2. Build
cmake --build build_debug -j10

# 3. Run (This will crash without the fix)
./build_debug/mixxx

@daschuer
Copy link
Copy Markdown
Member

Nice catch. This 1 line PR was probably more work than others with 1000 lines. Thank you for that.

Can you please rebase it to 2.5? The issue is already present there.

"git rebase --onto=2.5 HEAD~1"

This fixes a crash on macOS (Debug builds) where syncing AudioUnit parameters caused an index-out-of-bounds error. The loop condition  failed to grow the list when  (e.g., initially 0), causing  to access invalid memory.
@xARSENICx
Copy link
Copy Markdown
Contributor Author

This 1 line PR was probably more work than others with 1000 lines.

It did take me hours of digging into the codebase after struggling to continue my work on other features due to crashes. I hope others benefit from this and save time. 😄

Copy link
Copy Markdown
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

LGTM, Thank you.

@daschuer daschuer merged commit e446f07 into mixxxdj:2.5 Feb 3, 2026
13 checks passed
@xARSENICx xARSENICx deleted the fix-audiounit-crash branch February 3, 2026 06:43
@acolombier acolombier added this to the 2.5.5 milestone Feb 25, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in Releases Feb 25, 2026
@github-project-automation github-project-automation Bot moved this to In progress in Releases Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants