diff --git a/src/wrapper/clap/wrapper.rs b/src/wrapper/clap/wrapper.rs index 73a6abce..2f511576 100644 --- a/src/wrapper/clap/wrapper.rs +++ b/src/wrapper/clap/wrapper.rs @@ -1772,7 +1772,10 @@ impl Wrapper

{ unsafe extern "C" fn destroy(plugin: *const clap_plugin) { assert!(!plugin.is_null() && !(*plugin).plugin_data.is_null()); - drop(Arc::from_raw((*plugin).plugin_data as *mut Self)); + let this = Arc::from_raw((*plugin).plugin_data as *mut Self); + nih_debug_assert_eq!(Arc::strong_count(&this), 1); + + drop(this); } unsafe extern "C" fn activate( diff --git a/src/wrapper/vst3/wrapper.rs b/src/wrapper/vst3/wrapper.rs index 792afc0b..0e4183c6 100644 --- a/src/wrapper/vst3/wrapper.rs +++ b/src/wrapper/vst3/wrapper.rs @@ -60,6 +60,12 @@ impl Wrapper

{ } } +impl Drop for Wrapper

{ + fn drop(&mut self) { + nih_debug_assert_eq!(Arc::strong_count(&self.inner), 1); + } +} + impl IPluginBase for Wrapper

{ unsafe fn initialize(&self, _context: *mut c_void) -> tresult { // We currently don't need or allow any initialization logic