# HG changeset patch # User Benjamin Golinvaux # Date 1604336209 -3600 # Node ID 1151e25d731187c55653089321195e780943dbbf # Parent 4c9e68291467a93a0e85872845df071cd8d3088a Unregistering emscripten wheel and key events in the ViewerViewport destructor, to prevent callbacks being executed after the object has been deleted. diff -r 4c9e68291467 -r 1151e25d7311 Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp --- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Mon Nov 02 17:55:35 2020 +0100 +++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Mon Nov 02 17:56:49 2020 +0100 @@ -1738,6 +1738,13 @@ }*/ } + ~ViewerViewport() + { + emscripten_set_wheel_callback(viewport_->GetCanvasCssSelector().c_str(), this, true, NULL); + emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, NULL); + emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, NULL); + } + static EM_BOOL OnKey(int eventType, const EmscriptenKeyboardEvent *event, void *userData)