Audio/MidiJack: Fix invalid read: (3) of #5408
This atomically unsets the MidiJack reference in AudioJack right before MidiJack is destroyed. This avoids AudioJack using a destroyed MidiJack object.
This commit is contained in:
committed by
Johannes Lorenz
parent
9e9c5acc17
commit
e3cae80580
@@ -346,8 +346,8 @@ int AudioJack::processCallback( jack_nframes_t _nframes, void * _udata )
|
||||
// add to the following sound processing
|
||||
if( m_midiClient && _nframes > 0 )
|
||||
{
|
||||
m_midiClient->JackMidiRead(_nframes);
|
||||
m_midiClient->JackMidiWrite(_nframes);
|
||||
m_midiClient.load()->JackMidiRead(_nframes);
|
||||
m_midiClient.load()->JackMidiWrite(_nframes);
|
||||
}
|
||||
|
||||
for( int c = 0; c < channels(); ++c )
|
||||
|
||||
@@ -116,6 +116,9 @@ MidiJack::~MidiJack()
|
||||
{
|
||||
if(jackClient())
|
||||
{
|
||||
// remove ourselves first (atomically), so we will not get called again
|
||||
m_jackAudio->removeMidiClient();
|
||||
|
||||
if( jack_port_unregister( jackClient(), m_input_port) != 0){
|
||||
printf("Failed to unregister jack midi input\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user