Fix InitContext drop order for standalone presets
This commit is contained in:
parent
a202c3801a
commit
2ee3b7c2fa
|
@ -468,6 +468,7 @@ impl<P: Plugin, B: Backend<P>> Wrapper<P, B> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let sample_rate = self.buffer_config.sample_rate;
|
let sample_rate = self.buffer_config.sample_rate;
|
||||||
|
{
|
||||||
let mut plugin = self.plugin.lock();
|
let mut plugin = self.plugin.lock();
|
||||||
if let ProcessStatus::Error(err) = plugin.process(
|
if let ProcessStatus::Error(err) = plugin.process(
|
||||||
buffer,
|
buffer,
|
||||||
|
@ -485,6 +486,7 @@ impl<P: Plugin, B: Backend<P>> Wrapper<P, B> {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Any output note events are now in a vector that can be processed by the
|
// Any output note events are now in a vector that can be processed by the
|
||||||
// audio/MIDI backend
|
// audio/MIDI backend
|
||||||
|
@ -532,12 +534,15 @@ impl<P: Plugin, B: Backend<P>> Wrapper<P, B> {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// NOTE: This needs to be dropped after the `plugin` lock to avoid deadlocks
|
||||||
|
let mut init_context = self.make_init_context();
|
||||||
|
let mut plugin = self.plugin.lock();
|
||||||
// See above
|
// See above
|
||||||
permit_alloc(|| {
|
permit_alloc(|| {
|
||||||
plugin.initialize(
|
plugin.initialize(
|
||||||
&self.audio_io_layout,
|
&self.audio_io_layout,
|
||||||
&self.buffer_config,
|
&self.buffer_config,
|
||||||
&mut self.make_init_context(),
|
&mut init_context,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
plugin.reset();
|
plugin.reset();
|
||||||
|
|
Loading…
Reference in a new issue