mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
![]() With the following snippet there was a race: ``` if (instance === null) { instance = await create(); await instance.show(); } else { instance.create_with_existing_window(...); } ``` When awaiting for the promise that show() returns to settle, we would re-enter this function (due to a broken recursion guard, that's now removed). When re-entering, create_with_existing_window() is called, which - in order to access the slint::Window to re-use - must create the window adapter. Since that didn't happen from within an event loop invocation, winit would panic. Consequently, this patch set also makes create_with_existing_window() return a promise, as well as hide() (for the sake of it). The broken recursion guard is easy to fix (with a .finally() handler setting the boolean back), but that would mean we end up not always rendering the very latest sources. Plus, the same issue exists in wasm_preview.ts. Now, in case of subsequent re-entrancy in this code, we end up creating a bunch of create_with_exiting_window() promises, which will eventually settle and then we go back to the original show() call that will show the canvas. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |