mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
ARAAudioSourceReader: Fix data race
Prior to this fix a data race could occur on ARAAudioSourceReader::hostReader between the functions didEnableAudioSourceSamplesAccess() and readSamples().
This commit is contained in:
parent
bb8fe938d8
commit
180bbce579
1 changed files with 2 additions and 2 deletions
|
|
@ -121,11 +121,11 @@ bool ARAAudioSourceReader::readSamples (int* const* destSamples, int numDestChan
|
||||||
const auto destSize = (bitsPerSample / 8) * (size_t) numSamples;
|
const auto destSize = (bitsPerSample / 8) * (size_t) numSamples;
|
||||||
const auto bufferOffset = (int) (bitsPerSample / 8) * startOffsetInDestBuffer;
|
const auto bufferOffset = (int) (bitsPerSample / 8) * startOffsetInDestBuffer;
|
||||||
|
|
||||||
if (isValid() && hostReader != nullptr)
|
if (isValid())
|
||||||
{
|
{
|
||||||
const ScopedTryReadLock readLock (lock);
|
const ScopedTryReadLock readLock (lock);
|
||||||
|
|
||||||
if (readLock.isLocked())
|
if (readLock.isLocked() && hostReader != nullptr)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < tmpPtrs.size(); ++i)
|
for (size_t i = 0; i < tmpPtrs.size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue