mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-02 06:40:06 -04:00
Remove Canvas when dropped
This commit is contained in:
@@ -17,6 +17,12 @@ pub struct Canvas {
|
|||||||
on_mouse_scroll: Option<Closure<dyn FnMut(WheelEvent)>>,
|
on_mouse_scroll: Option<Closure<dyn FnMut(WheelEvent)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for Canvas {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.raw.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Canvas {
|
impl Canvas {
|
||||||
pub fn create() -> Result<Self, RootOE> {
|
pub fn create() -> Result<Self, RootOE> {
|
||||||
let window = web_sys::window().expect("Failed to obtain window");
|
let window = web_sys::window().expect("Failed to obtain window");
|
||||||
|
|||||||
Reference in New Issue
Block a user