diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2021-01-27 22:58:48 +0100 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2021-01-27 22:58:48 +0100 |
commit | 597b79f69aa3612c52cb070ce430cddd38af7cea (patch) | |
tree | eb726953017bb7397c2f92b372eb332da71659cd /src/engine/sidechain/shoutconnection.cpp | |
parent | 1387cbc1372eaae0c2d4309d4afd5e810419b149 (diff) | |
parent | 06c8be4ad6384a4bef4da0c121051fcbf48ac1f3 (diff) |
Merge remote-tracking branch 'upstream/2.3' into fdkaac-encoder3
Diffstat (limited to 'src/engine/sidechain/shoutconnection.cpp')
-rw-r--r-- | src/engine/sidechain/shoutconnection.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/engine/sidechain/shoutconnection.cpp b/src/engine/sidechain/shoutconnection.cpp index 644d3df415..cb01ff10ab 100644 --- a/src/engine/sidechain/shoutconnection.cpp +++ b/src/engine/sidechain/shoutconnection.cpp @@ -727,10 +727,15 @@ void ShoutConnection::process(const CSAMPLE* pBuffer, const int iBufferSize) { return; } + // Save a copy of the smart pointer in a local variable + // to prevent race conditions when resetting the member + // pointer while disconnecting in the worker thread! + const EncoderPointer pEncoder = m_encoder; + // If we are connected, encode the samples. - if (iBufferSize > 0 && m_encoder) { + if (iBufferSize > 0 && pEncoder) { setFunctionCode(6); - m_encoder->encodeBuffer(pBuffer, iBufferSize); + pEncoder->encodeBuffer(pBuffer, iBufferSize); // the encoded frames are received by the write() callback. } |