Audio/MidiJack: Fix invalid read: (2) of #5408

This patch
* makes `m_stopped` atomic
* initializes `m_stopped` correctly to `true`
* moves the initialization of `m_stopped` to the point where jack ports
  are already connected
This commit is contained in:
Johannes Lorenz
2020-04-15 21:56:21 +02:00
committed by Johannes Lorenz
parent c6d60e982e
commit 9e9c5acc17
2 changed files with 5 additions and 3 deletions

View File

@@ -34,6 +34,7 @@
#include "AudioWeakJack.h"
#endif
#include <atomic>
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QtCore/QMap>
@@ -106,7 +107,7 @@ private:
jack_client_t * m_client;
bool m_active;
bool m_stopped;
std::atomic<bool> m_stopped;
MidiJack *m_midiClient;
QVector<jack_port_t *> m_outputPorts;

View File

@@ -56,6 +56,8 @@ AudioJack::AudioJack( bool & _success_ful, Mixer* _mixer ) :
m_framesDoneInCurBuf( 0 ),
m_framesToDoInCurBuf( 0 )
{
m_stopped = true;
_success_ful = initJackClient();
if( _success_ful )
{
@@ -201,8 +203,6 @@ bool AudioJack::initJackClient()
void AudioJack::startProcessing()
{
m_stopped = false;
if( m_active || m_client == NULL )
{
return;
@@ -245,6 +245,7 @@ void AudioJack::startProcessing()
}
}
m_stopped = false;
free( ports );
}