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:
parent
92c090766a
commit
67e9cae37b
1 changed files with 9 additions and 6 deletions
|
@ -36,7 +36,6 @@ pub use egui;
|
||||||
//
|
//
|
||||||
// TODO: DPI scaling, this needs to be implemented on the framework level
|
// TODO: DPI scaling, this needs to be implemented on the framework level
|
||||||
// TODO: Opening the GUI causes an xrun, why?
|
// 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>(
|
pub fn create_egui_editor<T, U>(
|
||||||
parent: EditorWindowHandle,
|
parent: EditorWindowHandle,
|
||||||
size: Arc<AtomicCell<(u32, u32)>>,
|
size: Arc<AtomicCell<(u32, u32)>>,
|
||||||
|
@ -90,10 +89,7 @@ where
|
||||||
|
|
||||||
// There's no error handling here, so let's just pray it worked
|
// There's no error handling here, so let's just pray it worked
|
||||||
if window.is_open() {
|
if window.is_open() {
|
||||||
Some(Box::new(EguiEditor {
|
Some(Box::new(EguiEditor { window, size }))
|
||||||
_window: window,
|
|
||||||
size,
|
|
||||||
}))
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -101,7 +97,7 @@ where
|
||||||
|
|
||||||
/// An [Editor] implementation that calls an egui draw loop.
|
/// An [Editor] implementation that calls an egui draw loop.
|
||||||
pub struct EguiEditor {
|
pub struct EguiEditor {
|
||||||
_window: WindowHandle,
|
window: WindowHandle,
|
||||||
size: Arc<AtomicCell<(u32, u32)>>,
|
size: Arc<AtomicCell<(u32, u32)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,3 +111,10 @@ impl Editor for EguiEditor {
|
||||||
self.size.load()
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue