emscripten-core / emscripten-core/emscripten

Crash in _emscripten_set_wheel_callback_on_thread

Offen
#17,517 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
27.6k
Forks
3.6k
Ø Merge
1 T. 6 Std.
Gemergte PRs (30 T.)
109

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.