From be1012d64eb7a4b462a7db810923b0b28563f3f9 Mon Sep 17 00:00:00 2001 From: Stefan Westerfeld Date: Tue, 26 Nov 2019 11:22:04 +0100 Subject: [PATCH] Fix thread-safety issue in a-fluidsynth. This fix ensures that the a-fluidsynth "synth" object is not used in two threads at the same time during midi event handling (run() in RT thread vs. load_sf2() in worker thread), which could result in crashes. --- libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc b/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc index cde370ead5..1ec184fdf3 100644 --- a/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc +++ b/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc @@ -514,7 +514,7 @@ run (LV2_Handle instance, uint32_t n_samples) } } else if (ev->body.type == self->midi_MidiEvent) { - if (ev->body.size > 3 || ev->time.frames >= n_samples) { + if (ev->body.size > 3 || ev->time.frames >= n_samples || self->reinit_in_progress) { continue; }