# HG changeset patch # User Sebastien Jodogne # Date 1604383442 -3600 # Node ID 0f8d6791b403471e436b6632b8a7a923848c0f93 # Parent 575f512cdf488013ecc6c3d611d8bf6a47d1d074 fix build by making the destructor of ViewerViewport public diff -r 575f512cdf48 -r 0f8d6791b403 Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp --- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Mon Nov 02 20:45:04 2020 +0100 +++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Tue Nov 03 07:04:02 2020 +0100 @@ -1738,13 +1738,6 @@ }*/ } - ~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) @@ -1797,6 +1790,16 @@ } public: + virtual ~ViewerViewport() + { + // Unregister the callbacks to avoid any call with a "void*" that + // has been destroyed. "WebAssemblyViewport::GetObjectCookie()" + // provides a more advanced alternative. + 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 boost::shared_ptr Create(OrthancStone::ILoadersContext::ILock& lock, const OrthancStone::DicomSource& source, const std::string& canvas,