Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioUnitManager: Wrap every instance in a shared pointer #13945

Merged
merged 7 commits into from
Dec 15, 2024

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Nov 29, 2024

This is a small patch I extracted from #13887 (and rebased to 2.5), which fixes a dangling pointer issue when Audio Units are instantiated asynchronously.

The issue is that the async initialization callback captures the AudioUnitManager instance, which is unsafe if the instance doesn't outlive the callback. The solution is to simply wrap the AudioUnitManager in a QSharedPointer, which ensures that the callback keeps the manager instance alive for as long as necessary. See #13887 (comment) for further rationale.

I consider it relatively safe to merge this for 2.5 since it doesn't change anything about the instantiation logic itself (Audio Units are still instantiated synchronously to read the parameters and asynchronously once activated). The migration to make everything asynchronous will then be deferred to 2.6 via #13887.

fwcd added 2 commits November 29, 2024 14:35
This is slightly more defensive against issues during instantiation and
also catches issues during sync instantiation.
@fwcd fwcd force-pushed the managed-audiounitmanager branch from 4e6a2cc to 430aa00 Compare November 29, 2024 13:58
@JoergAtGithub JoergAtGithub added this to the 2.5.0 milestone Nov 29, 2024
@m0dB
Copy link
Contributor

m0dB commented Nov 30, 2024

LGTM except for the missing p prefix.

@fwcd fwcd force-pushed the managed-audiounitmanager branch from 5fdc54f to e881740 Compare November 30, 2024 02:28
@fwcd fwcd requested a review from m0dB December 2, 2024 22:42
@fwcd fwcd mentioned this pull request Dec 4, 2024
@fwcd
Copy link
Member Author

fwcd commented Dec 12, 2024

Can this be merged?

@m0dB
Copy link
Contributor

m0dB commented Dec 14, 2024

It LGTM, but I find it hard to assess the risk so close to 2.5 release. Then again, this is all very isolated. If @daschuer doesn't object, I will merge this.

@JoergAtGithub
Copy link
Member

It LGTM, but I find it hard to assess the risk so close to 2.5 release.

At least we have one user who reports, that this PR fixes an issue: #13967 (comment)

@m0dB
Copy link
Contributor

m0dB commented Dec 15, 2024

LGTM

@m0dB m0dB merged commit ac5b48c into mixxxdj:2.5 Dec 15, 2024
13 checks passed
@fwcd fwcd deleted the managed-audiounitmanager branch December 15, 2024 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants