1
0
Fork 0

Explicitly close the egui-baseview window

It's supposed to do this on drop, but it doesn't seem to work.
This commit is contained in:
Robbert van der Helm 2022-02-06 15:08:57 +01:00
parent 92c090766a
commit 67e9cae37b

View file

@ -36,7 +36,6 @@ pub use egui;
//
// TODO: DPI scaling, this needs to be implemented on the framework level
// TODO: Opening the GUI causes an xrun, why?
// TODO: The current version of egui-baseview causes a SIGABRT you when you close the GUI
pub fn create_egui_editor<T, U>(
parent: EditorWindowHandle,
size: Arc<AtomicCell<(u32, u32)>>,
@ -90,10 +89,7 @@ where
// There's no error handling here, so let's just pray it worked
if window.is_open() {
Some(Box::new(EguiEditor {
_window: window,
size,
}))
Some(Box::new(EguiEditor { window, size }))
} else {
None
}
@ -101,7 +97,7 @@ where
/// An [Editor] implementation that calls an egui draw loop.
pub struct EguiEditor {
_window: WindowHandle,
window: WindowHandle,
size: Arc<AtomicCell<(u32, u32)>>,
}
@ -115,3 +111,10 @@ impl Editor for EguiEditor {
self.size.load()
}
}
impl Drop for EguiEditor {
fn drop(&mut self) {
// XXX: This should automatically happen when the handle gets dropped, but apparently not
self.window.close();
}
}