Fix InitContext drop order for standalone presets
This commit is contained in:
parent
a202c3801a
commit
2ee3b7c2fa
|
@ -468,22 +468,24 @@ 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();
|
{
|
||||||
if let ProcessStatus::Error(err) = plugin.process(
|
let mut plugin = self.plugin.lock();
|
||||||
buffer,
|
if let ProcessStatus::Error(err) = plugin.process(
|
||||||
aux,
|
buffer,
|
||||||
&mut self.make_process_context(transport, input_events, output_events),
|
aux,
|
||||||
) {
|
&mut self.make_process_context(transport, input_events, output_events),
|
||||||
nih_error!("The plugin returned an error while processing:");
|
) {
|
||||||
nih_error!("{}", err);
|
nih_error!("The plugin returned an error while processing:");
|
||||||
|
nih_error!("{}", err);
|
||||||
|
|
||||||
let push_successful = gui_task_sender.send(GuiTask::Close).is_ok();
|
let push_successful = gui_task_sender.send(GuiTask::Close).is_ok();
|
||||||
nih_debug_assert!(
|
nih_debug_assert!(
|
||||||
push_successful,
|
push_successful,
|
||||||
"Could not queue window close, the editor will remain open"
|
"Could not queue window close, the editor will remain open"
|
||||||
);
|
);
|
||||||
|
|
||||||
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
|
||||||
|
@ -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