Skip to content

Conversation

jcavar
Copy link
Contributor

@jcavar jcavar commented Jun 16, 2025

This fixes the crash in macOS and iOS 26. This is the same fix @NickCulbertson did in his branch, just without manual flag management.

It seems like the engine should perform this check internally and not invoke deallocateRenderResources when not needed, but this also feels like low risk change to protect against buggy host.

Resolves: #33

@jcavar jcavar requested review from aure and wtholliday as code owners June 16, 2025 10:48
@NickCulbertson
Copy link
Member

@jcavar I do prefer your method using an AUAudioUnit internal state, but I'm not sure if renderResourcesAllocated is ever true in deallocateRenderResources.

In this repo https://github.com/NickCulbertson/AUTests_iOS26 if you unload an engine that was playing, it calls deallocateRenderResources, deinit, deallocateRenderResources. Both deallocateRenderResources calls are returned because renderResourcesAllocated is false.

The issue I was seeing with crashes only occurred when calling deallocateRenderResourcesDSP(dsp) after deinit. If deallocateRenderResources is called before deinit I still think we want to pass deallocateRenderResourcesDSP(dsp). The odd thing is that we are already calling deallocateRenderResourcesDSP(dsp) after deinit in iOS 18 but that doesn't crash.

This fixes the crash in macOS and iOS 26.
@jcavar
Copy link
Contributor Author

jcavar commented Jun 16, 2025

Great catch @NickCulbertson, I've updated the code to take a snapshot of renderResourcedAllocated before a super call (where this flag is being set)

@NickCulbertson
Copy link
Member

Yes, this appears to be working correctly now! 🙌

It's ready for @aure or @wtholliday review.

@wtholliday
Copy link
Member

I guess those 18 test failures are just other stuff? Maybe fix those first?

These md5's were recorded at 44100, but Settings default sample rate
changed to 48000
@jcavar
Copy link
Contributor Author

jcavar commented Jun 17, 2025

I guess those 18 test failures are just other stuff? Maybe fix those first?

These failures are due to the default sample rate change in Settings. I've fixed them by hardcoding the sample rate to 44100 in the test setup.

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.

DSPBase::deallocateRenderResourcesDSP causes EXC_BAD_ACCESS in macOS Tahoe
3 participants