Fix "bad_access error" when playing short time at high frequency with fade out#96
Open
Kta-M wants to merge 1 commit intokstenerud:masterfrom
Open
Fix "bad_access error" when playing short time at high frequency with fade out#96Kta-M wants to merge 1 commit intokstenerud:masterfrom
Kta-M wants to merge 1 commit intokstenerud:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I fixed a bug regarding the error: "EXC_BAD_ACCESS" which made the app crashed.
It occurs when playing sound short time at high frequency with fade out.
(at
ObjectAL/ObjectAL/Actions/OALActionManager.m#L160)When starting fade out, a fade action added to
OALActionManager targetActions, and it removed when fade out was completed. However, there is a time lag between releasingALSourceand removing fade action fromtargetActions.App crashes during the time lag when a new
ALSourceis generated with the same id as the released oldAlSourceone and when an action from theALSourceis added to the to thetargetActions.Regarding the
OALActionManager step:timer, when a new fade action from theALSourceis attempting to be added, the id of the releasedALSourcehowever remains present in thetargets. Therefore, the new fade action is added to the array of actions for oldALSourceintargetActions. Next, the fade action of releasedALSourceis removed, but the id of releasedALSourceis not removed fromtargetsbecause the fade action of newALSourceremains in the array of actions intargetActions. Hence the next timeOALActionManager step:timeris called, the app will crash trying to reference the id of releasedALSourceintargets.To fix it, I swapped the order of adding and removing actions in the code, and removed the master timer stop condition and placed it out, at the end of the adding/removing process.
The following code is for verification. It reproduces this bug.