Skip to content

Commit

Permalink
pass Parent by reference to Plugin::editor()
Browse files Browse the repository at this point in the history
  • Loading branch information
micahrj committed Apr 23, 2024
1 parent 93b9aba commit fc227f5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/gain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Plugin for Gain {
}
}

fn editor(&mut self, parent: Parent) -> Self::Editor {
fn editor(&mut self, parent: &Parent) -> Self::Editor {
GainEditor::open(parent).unwrap()
}
}
Expand Down Expand Up @@ -138,7 +138,7 @@ pub struct GainEditor {
}

impl GainEditor {
fn open(parent: Parent) -> portlight::Result<GainEditor> {
fn open(parent: &Parent) -> portlight::Result<GainEditor> {
let app = AppOptions::new().mode(AppMode::Guest).build()?;

let mut options = WindowOptions::new();
Expand Down
2 changes: 1 addition & 1 deletion src/format/clap/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<P: Plugin> Instance<P> {
let instance = &*(plugin as *const Self);
let main_thread_state = &mut *instance.main_thread_state.get();

let editor = main_thread_state.plugin.editor(Parent::from_raw(raw_parent));
let editor = main_thread_state.plugin.editor(&Parent::from_raw(raw_parent));
main_thread_state.editor = Some(editor);

true
Expand Down
2 changes: 1 addition & 1 deletion src/format/clap/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Plugin for TestPlugin {
fn processor(&mut self, _config: Config) -> Self::Processor {
TestProcessor
}
fn editor(&mut self, _parent: Parent) -> Self::Editor {
fn editor(&mut self, _parent: &Parent) -> Self::Editor {
TestEditor
}

Expand Down
2 changes: 1 addition & 1 deletion src/format/vst3/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl Plugin for TestPlugin {
fn processor(&mut self, _config: Config) -> Self::Processor {
TestProcessor
}
fn editor(&mut self, _parent: Parent) -> Self::Editor {
fn editor(&mut self, _parent: &Parent) -> Self::Editor {
TestEditor
}

Expand Down
2 changes: 1 addition & 1 deletion src/format/vst3/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<P: Plugin> IPlugViewTrait for View<P> {

let main_thread_state = &mut *self.main_thread_state.get();

let editor = main_thread_state.plugin.editor(Parent::from_raw(raw_parent));
let editor = main_thread_state.plugin.editor(&Parent::from_raw(raw_parent));
main_thread_state.editor = Some(editor);

kResultOk
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub trait Plugin: Send + Sized + 'static {
fn save(&self, output: &mut impl Write) -> io::Result<()>;
fn load(&mut self, input: &mut impl Read) -> io::Result<()>;
fn processor(&mut self, config: Config) -> Self::Processor;
fn editor(&mut self, parent: Parent) -> Self::Editor;
fn editor(&mut self, parent: &Parent) -> Self::Editor;

#[allow(unused_variables)]
fn latency(&self, config: &Config) -> u64 {
Expand Down

0 comments on commit fc227f5

Please sign in to comment.