diff --git a/src/context.rs b/src/context.rs index 84f026fe..39e1075c 100644 --- a/src/context.rs +++ b/src/context.rs @@ -31,17 +31,15 @@ pub(crate) const TASK_QUEUE_CAPACITY: usize = 512; /// General callbacks the plugin can make during its lifetime. This is passed to the plugin during /// [Plugin::initialize]. -/// -/// # Safety -/// -/// This context is passed to be stored by the plugin, and it may thus not outlive the wrapper. -/// Hence the use of reference counted smart pointers. The implementing wrapper needs to be able to -/// handle concurrent requests, and it should perform the actual callback within -/// [MainThreadQueue::do_maybe_async]. -pub unsafe trait ProcessContext { +// +// # Safety +// +// The implementing wrapper needs to be able to handle concurrent requests, and it should perform +// the actual callback within [MainThreadQueue::do_maybe_async]. +pub trait ProcessContext { /// Update the current latency of the plugin. If the plugin is currently processing audio, then /// this may cause audio playback to be restarted. - fn set_latency_samples(self: &Arc, samples: u32); + fn set_latency_samples(&self, samples: u32); } /// A trait describing the functionality of the platform-specific event loop that can execute tasks diff --git a/src/wrapper/vst3.rs b/src/wrapper/vst3.rs index 72884b3e..a7cec81f 100644 --- a/src/wrapper/vst3.rs +++ b/src/wrapper/vst3.rs @@ -263,8 +263,8 @@ impl MainThreadExecutor for WrapperInner<'_, P> { } } -unsafe impl ProcessContext for WrapperInner<'_, P> { - fn set_latency_samples(self: &Arc, samples: u32) { +impl ProcessContext for WrapperInner<'_, P> { + fn set_latency_samples(&self, samples: u32) { self.current_latency.store(samples, Ordering::SeqCst); let task_posted = unsafe { self.event_loop.read().assume_init_ref() }.do_maybe_async( Task::TriggerRestart(vst3_sys::vst::RestartFlags::kLatencyChanged as u32),