Closed pkomon-tgm closed 4 months ago
This issue is a limitation of emscripten's Asyncify feature, which allows WASM code execution to be paused and resumed (and therefore behave like an async function in JS). Asyncify only allows for a single async call to be executed at a time, however.
Our issue arises when we send a request (using Qt's QNetworkRequest, which I am assuming, is using Asyncify too) while also a mouse event happens. We have custom mouse handlers in place in our custom emscripten shell here
where we also call back into C++ code. This is also an async call, and finally triggers our error. This theory is supported by the fact that we don't use custom mouse event handlers on AlpineMaps, where this issue does not arise.
Emscripten has a section in its documentation detailing the issue: https://emscripten.org/docs/porting/asyncify.html#reentrancy
Still have to figure out a reasonable, non-hacky workaround.
Using emscripten's ccall
and async
/await
functions fixes this issue.
Fixed in f2431fcbd7e832e0cd920dceb1c77168ab2f848d (mouse, canvas resize) and 13cc6e9142e04af355edb08a54d7324606f745e0 (touch).
Occasionally, mouse inputs causes the app to become unresponsive and freeze.
This issue is much easier to reproduce when the dev tools (Google Chrome) are open, however it seems to also occur without them sometimes.
To reproduce