wasm: fix errors reported in console by wrapping given functions in fyne.Do#6103
wasm: fix errors reported in console by wrapping given functions in fyne.Do#6103schnoddelbotz wants to merge 3 commits into
Conversation
|
I am not that familiar with the wasm runtime but I think it's more likely that the main thread detection doesn't work on wasm (and therefore that these warnings are false positives) then that there's an actual threading issue. Especially since I'm pretty sure wasm is single-threaded |
andydotxyz
left a comment
There was a problem hiding this comment.
Elsewhere in this file we use runOnMain. Does it work if that fix is in place instead?
I think the change could be logical.
As @dweymouth says we may need to look at how the WASM GLFW works - but this seems like a good intermediate change - if we can match the pattern used elsewhere.
|
I took another look at this and parked resulting changes in another branch: Findings:
|
If runOnMain can deadlock then it means fyne.Do was not the right answer after all - it was just hiding deeper,
This is a separate issue I think - fyne-io/demo#4 |
|
Can you comment on the state of this @schnoddelbotz ? If you think it is still the right approach then please can you re-base on develop now that v2.8.0 is out? Threading has changed a little and this may be better/worse as a result. |
For my app as well as for Fyne Demo, with Fyne 2.7.x and 2.8.0, the mentioned console errors can be fully silenced by setting the Given I didn't run into any freezes or error messages since I enabled the migration, I believe dweymouth may have been right from the start, calling the messages false positives. Admittedly, I furthermore wasn't aware that enabling the migration did not only silence warnings but also change behaviour (by wrapping affected calls). Accordingly, I'd suggest to close this PR, as it tries to solve a non-issue that can be solved by configuration. |
Thanks for calling that out, I am updating the demo now.
It does not solve it by wrapping - it removes old safeties that the warnings were attempting to flag were being relied upon. If it works great without it then I guess we should close the PR though. However, if the events are in fact firing on different goroutines (I think we assumed that with WASM they could not) then there is still a bug. |

Description:
The current fyne Demo on https://demo.fyne.io/ (2.6.0) as well as current https://github.com/fyne-io/demo throw errors in browser console, indicating that some function calls in
internal/driver/glfw/window_wasm.goshould be wrapped in Fyne.Do(), e.g.The error can be triggered by going to Widget->Entry and typing some characters into one of the text inputs.
The change in this PR just implements the fix indicated by the error message and successfully silences any corresponding error messages for me.
Checklist: