These two reports give clear crash stacks:
but I have no idea what happens. These two crashes happens when the cubeb stream is destroyed, so the resampler would be destroyed by code here and here. The inner pointer of
Resampler that points to a resampler in use will be reset to a null pointer after destroying the currently used resampler. If the inner pointer of
Resampler is currently null, nothing would be released since it means there is no active resampler.
The crash reason is EXC_BAD_ACCESS, so I guess it's a Use-After-Free case. But I don't know what makes it happen. If it crashes here, it means we try destroying a resampler that has been destroyed. If the resampler has been destroyed, then the inner pointer of
Resampler would be set to
Resampler::destroy wouldn't do anything....
One possible situation is that
Resampler::destroy is being called at the same time within multiple threads.
Resampler::destroy could be called in reinit thread when switching audio devices or in a task thread when the cubeb stream is destroyed. But these two destroying tasks would be run on the same dispatch queue...
I'll keep the needinfo for now, as a reminder to revisit this problem.