mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00
![]() There's a memory leak that causes the created canvas elements not be deleted. I've tried a few thing such as explicitly hiding the window (destroying the canvas element instance refs and gl resources we keep in Rust), but it's not enough - somewhere there remains a circular reference. Possibly between some of the closures installed in Rust and DOM elements they are installed on as event handlers. I also tried using the wasm-bindgen support for weak refs, but no luck. So instead, to plug the leak, this patch introduces the re-use of the HTML canvas element in a way that is similar to how the preview works in vs code's live preview. I verified that no GL resources or new canvas elements are leaked in Chrome's heap profiler via snapshot comparison and filtering for the corresponding DOM element types. |
||
---|---|---|
.. | ||
lib.rs |