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

Possible retain cycle in SuperpoweredIosAudio #792

Open
kenneide opened this issue Nov 28, 2024 · 1 comment
Open

Possible retain cycle in SuperpoweredIosAudio #792

kenneide opened this issue Nov 28, 2024 · 1 comment

Comments

@kenneide
Copy link

kenneide commented Nov 28, 2024

We noticed some crashes in our app which appears to be happening when a SuperpoweredIosAudio reacted to a notification and then dereferenced a null pointer. Upon further investigation, it seemed that the object was not being destroyed when we expected it to be because the stopTimer object maintained a strong reference to it and would prevent destruction by our wrapper which owned the Superpowered object --> in other words, it is a retain cycle.

It appears that when using manual release counting, this is accounted for in the code -- but when using ARC, seemingly not.

This can be prevented in many ways, for example by using a weak pointer. You can find further details in this StackOverflow post: https://stackoverflow.com/questions/40358646/invalidating-an-nstimer-in-dealloc

In our case, as we don't need the timer we cannot init it at all, and we can see that the object is destroyed when we expect it to be.

PS It was fun hanging out with you guys at ADC!

@ivannador
Copy link
Contributor

Hey @kenneide ,

Thanks for pointing this out. We will look into it - although this is in the open source part of the library, so if you feel like it, don't hesitate to open a PR with the fix!

PS It was nice meeting you as well!

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

No branches or pull requests

2 participants