emscripten-core / emscripten-core/emscripten
Crash in _emscripten_set_wheel_callback_on_thread
- Langage dominant
- C++
- Étoiles
- 27.6k
- Forks
- 3.6k
- Merge moyen
- 1 j 14 h
- PR mergées (30 j)
- 125
Description
When my WASM code calls SDL_DestroyWindow, it proceeds to unregister various callbacks. As part of this it calls _emscripten_set_wheel_callback_on_thread, which throws an exception `null is not an object (evaluating 'target.onwheel')`, because `target` is null, because the canvas has already been removed from the DOM.
SDL_DestroyWindow is ultimately called from componentDidUnmount by Reactjs. The canvas is there at the time of SDL_DestroyWindow, but _emscripten_set_wheel_callback_on_thread is called asynchronously on the next tick (because of the _on_thread) and by that time the canvas is gone.
The offending line is:
https://github.com/emscripten-core/emscripten/blob/77da62969eb0b5efe4ce4a0c9ce67c45b9e32638/src/library_html5.js#L700
I think this line should check that target isn't null and do nothing if it is.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez dans src/library_html5.js, à la ligne référencée dans _emscripten_set_wheel_callback_on_thread, et examinez comment la cible du callback est obtenue. Reproduisez le chemin d’exécution de SDL_DestroyWindow après que React a supprimé le canvas, puis vérifiez qu’une cible manquante ne provoque plus d’exception lors du nettoyage du callback.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, react, wasm
- Domaine
- frontend, web-dev
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 55/100