mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Add debug assertions for Arc strong counts
To make issues like the event loop thing more visible.
This commit is contained in:
@@ -1772,7 +1772,10 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||
|
||||
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(
|
||||
|
||||
@@ -60,6 +60,12 @@ impl<P: Vst3Plugin> Wrapper<P> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: Vst3Plugin> Drop for Wrapper<P> {
|
||||
fn drop(&mut self) {
|
||||
nih_debug_assert_eq!(Arc::strong_count(&self.inner), 1);
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: Vst3Plugin> IPluginBase for Wrapper<P> {
|
||||
unsafe fn initialize(&self, _context: *mut c_void) -> tresult {
|
||||
// We currently don't need or allow any initialization logic
|
||||
|
||||
Reference in New Issue
Block a user