When reopening vst plugin window, the earlier draw loop continues to run, leading to multiple simultaneous ui-processes running.
Steps to reproduce: add times_opened usize to editor and pass incremented copy of it to window state. Then close and reopen window couple of times:
fn close(&mut self) {
self.is_open = false;
if let Some(mut window_handle) = self.window_handle.take() {
(window_handle.0).close();
}
}
fn open(&mut self, parent: *mut ::std::ffi::c_void) -> bool {
match self.is_open() {
true => false,
false => {
// info!("Open editor");
self.is_open = true;
self.times_opened += 1;
let settings = Settings {
...
};
let window_handle = EguiWindow::open_parented(
&VstParent(parent),
settings,
(
self.times_opened,
),
|_egui_ctx, _queue, _state| {},
|egui_ctx: &CtxRef, _, (times_opened)| {
info!("{}: draw", times_opened);
ui::draw_ui(egui_ctx); // ui draw func
},
);
self.window_handle = Some(WindowParent(window_handle));
true
}
}
If opened 2 times, this prints continuously
1: draw
2: draw
1: draw
2: draw
...
When reopening vst plugin window, the earlier draw loop continues to run, leading to multiple simultaneous ui-processes running.
Steps to reproduce: add times_opened usize to editor and pass incremented copy of it to window state. Then close and reopen window couple of times:
If opened 2 times, this prints continuously