1
0
Fork 0

Add missing debug assertions for VST3 callback

This commit is contained in:
Robbert van der Helm 2023-02-06 18:00:33 +01:00
parent 0abfcb6045
commit d2b25f8682
2 changed files with 10 additions and 2 deletions

View file

@ -582,14 +582,21 @@ impl<P: Vst3Plugin> MainThreadExecutor<Task<P>> for WrapperInner<P> {
Task::TriggerRestart(flags) => match &*self.component_handler.borrow() {
Some(handler) => unsafe {
nih_debug_assert!(is_gui_thread);
handler.restart_component(flags);
let result = handler.restart_component(flags);
nih_debug_assert_eq!(
result,
kResultOk,
"Failed the restart request call with flags '{:?}'",
flags
);
},
None => nih_debug_assert_failure!("Component handler not yet set"),
},
Task::RequestResize => match &*self.plug_view.read() {
Some(plug_view) => unsafe {
nih_debug_assert!(is_gui_thread);
plug_view.request_resize();
let success = plug_view.request_resize();
nih_debug_assert!(success, "Failed requesting a window resize");
},
None => nih_debug_assert_failure!("Can't resize a closed editor"),
},

View file

@ -120,6 +120,7 @@ impl<P: Vst3Plugin> WrapperView<P> {
/// # Safety
///
/// May cause memory corruption in Linux REAPER when called from outside of the `IRunLoop`.
#[must_use]
pub unsafe fn request_resize(&self) -> bool {
// Don't do anything if the editor is not open, because that would be strange
if self