Mercurial > hg > orthanc-stone
diff Applications/Samples/WebAssembly/RtViewer/RtViewerWasm.cpp @ 1619:4c9e68291467
Added code to remove the wheel callback in dtor, to prevent access to dead object
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 02 Nov 2020 17:55:35 +0100 |
parents | 74ed691f9c64 |
children | 52b8b96cb55f |
line wrap: on
line diff
--- a/Applications/Samples/WebAssembly/RtViewer/RtViewerWasm.cpp Mon Nov 02 17:54:18 2020 +0100 +++ b/Applications/Samples/WebAssembly/RtViewer/RtViewerWasm.cpp Mon Nov 02 17:55:35 2020 +0100 @@ -109,6 +109,18 @@ return viewport; } + void RtViewerView::CleanupViewportEvents() + { + void* userData = reinterpret_cast<void*>(this); + std::string selector = "#" + canvasId_; + emscripten_set_wheel_callback_on_thread( + selector.c_str(), + userData, + false, + NULL, + EM_CALLBACK_THREAD_CONTEXT_CALLING_THREAD); + } + void RtViewerView::TakeScreenshot(const std::string& target, unsigned int canvasWidth, unsigned int canvasHeight)