From 52fbaa6042775cd951a30398b45b25db7124d45f Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 29 Mar 2021 15:21:14 +0100 Subject: [PATCH] Linux: Stop MidiInputThread before freeing handle in AlsaClient destructor When immediately closing a MidiInput after starting, the ALSA handle may be closed whilst the MidiInputThread is running and it polls a destroyed handle --- modules/juce_audio_devices/native/juce_linux_Midi.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/juce_audio_devices/native/juce_linux_Midi.cpp b/modules/juce_audio_devices/native/juce_linux_Midi.cpp index 6fa0fbebe8..ba97d2988b 100644 --- a/modules/juce_audio_devices/native/juce_linux_Midi.cpp +++ b/modules/juce_audio_devices/native/juce_linux_Midi.cpp @@ -51,13 +51,13 @@ public: jassert (instance != nullptr); instance = nullptr; - if (handle != nullptr) - snd_seq_close (handle); - jassert (activeCallbacks.get() == 0); if (inputThread) inputThread->stopThread (3000); + + if (handle != nullptr) + snd_seq_close (handle); } static String getAlsaMidiName()