comparison 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
comparison
equal deleted inserted replaced
1618:9a52bac0c2a7 1619:4c9e68291467
107 EM_CALLBACK_THREAD_CONTEXT_CALLING_THREAD); 107 EM_CALLBACK_THREAD_CONTEXT_CALLING_THREAD);
108 108
109 return viewport; 109 return viewport;
110 } 110 }
111 111
112 void RtViewerView::CleanupViewportEvents()
113 {
114 void* userData = reinterpret_cast<void*>(this);
115 std::string selector = "#" + canvasId_;
116 emscripten_set_wheel_callback_on_thread(
117 selector.c_str(),
118 userData,
119 false,
120 NULL,
121 EM_CALLBACK_THREAD_CONTEXT_CALLING_THREAD);
122 }
123
112 void RtViewerView::TakeScreenshot(const std::string& target, 124 void RtViewerView::TakeScreenshot(const std::string& target,
113 unsigned int canvasWidth, 125 unsigned int canvasWidth,
114 unsigned int canvasHeight) 126 unsigned int canvasHeight)
115 { 127 {
116 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); 128 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);