Previously, any frames in flight (`requestAnimationFrame`) on web were not being cancelled (`cancelAnimationFrame`) when `WebRunner::destroy` was called. If a user called `destroy`, then immediately removed the canvas from the DOM, eframe could panic with a "failed to find (canvas) element by id" error message. This PR changes two things: - The canvas element is directly referenced everywhere it's needed instead of being looked up by `canvas_id`[^1] - The RAF handle is stored in `WebRunner` and `cancelAnimationFrame` is called on it inside of `WebRunner::destroy`[^2] [^1]: The WebGL/WGPU backends were already holding onto the canvas (and associated GPU context), so the change is just converting all the `get_element_by_id` lookups to retrieve the canvas from the web runner handle. [^2]: There is only ever one frame in flight, so we store it directly as a scalar field. |
||
|---|---|---|
| .. | ||
| app_runner.rs | ||
| backend.rs | ||
| events.rs | ||
| input.rs | ||
| mod.rs | ||
| panic_handler.rs | ||
| screen_reader.rs | ||
| storage.rs | ||
| text_agent.rs | ||
| web_logger.rs | ||
| web_painter.rs | ||
| web_painter_glow.rs | ||
| web_painter_wgpu.rs | ||
| web_runner.rs | ||