slint/api/wasm-interpreter/src
Simon Hausmann d9efc95dda Fix console errors in the online editor about GL context losses after some editing
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.
2022-09-07 12:03:37 +02:00
..
lib.rs Fix console errors in the online editor about GL context losses after some editing 2022-09-07 12:03:37 +02:00