diff --git a/src/platform_impl/web/web_sys/canvas.rs b/src/platform_impl/web/web_sys/canvas.rs index 27481349..845c3ee3 100644 --- a/src/platform_impl/web/web_sys/canvas.rs +++ b/src/platform_impl/web/web_sys/canvas.rs @@ -17,6 +17,12 @@ pub struct Canvas { on_mouse_scroll: Option>, } +impl Drop for Canvas { + fn drop(&mut self) { + self.raw.remove(); + } +} + impl Canvas { pub fn create() -> Result { let window = web_sys::window().expect("Failed to obtain window");