emscripten-core / emscripten-core/emscripten

Crash in _emscripten_set_wheel_callback_on_thread

Abierto
#17,517 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
27.6k
Forks
3.6k
Merge medio
1 d 14 h
PR fusionados (30 d)
125

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza en src/library_html5.js, en la línea referenciada dentro de _emscripten_set_wheel_callback_on_thread, e inspecciona cómo se obtiene el destino del callback. Reproduce la ruta de SDL_DestroyWindow después de que React elimine el canvas y, a continuación, verifica que la ausencia del destino ya no provoque una excepción durante la limpieza del callback.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, react, wasm
Área
frontend, web-dev
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
55/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.