From d2b25f86820aa329cd5f3234e22bf9df3b5cb9b0 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 6 Feb 2023 18:00:33 +0100 Subject: [PATCH] Add missing debug assertions for VST3 callback --- src/wrapper/vst3/inner.rs | 11 +++++++++-- src/wrapper/vst3/view.rs | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/wrapper/vst3/inner.rs b/src/wrapper/vst3/inner.rs index e3cc8249..acc83a8a 100644 --- a/src/wrapper/vst3/inner.rs +++ b/src/wrapper/vst3/inner.rs @@ -582,14 +582,21 @@ impl MainThreadExecutor> for WrapperInner

{ 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"), }, diff --git a/src/wrapper/vst3/view.rs b/src/wrapper/vst3/view.rs index 537bc893..e70bf943 100644 --- a/src/wrapper/vst3/view.rs +++ b/src/wrapper/vst3/view.rs @@ -120,6 +120,7 @@ impl WrapperView

{ /// # 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