comparison Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1623:74be0f498b08

Updated mechanism to avoid using deleted objects in RequestAnimationFrame callbacks.
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 04 Nov 2020 11:39:15 +0100
parents 0f8d6791b403
children 78509230f0d7
comparison
equal deleted inserted replaced
1622:0f8d6791b403 1623:74be0f498b08
1791 1791
1792 public: 1792 public:
1793 virtual ~ViewerViewport() 1793 virtual ~ViewerViewport()
1794 { 1794 {
1795 // Unregister the callbacks to avoid any call with a "void*" that 1795 // Unregister the callbacks to avoid any call with a "void*" that
1796 // has been destroyed. "WebAssemblyViewport::GetObjectCookie()" 1796 // has been destroyed. "WebAssemblyViewport::CreateObjectCookie()"
1797 // provides a more advanced alternative. 1797 // provides a more advanced alternative.
1798 emscripten_set_wheel_callback(viewport_->GetCanvasCssSelector().c_str(), this, true, NULL); 1798 emscripten_set_wheel_callback(viewport_->GetCanvasCssSelector().c_str(), this, true, NULL);
1799 emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, NULL); 1799 emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, NULL);
1800 emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, NULL); 1800 emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, NULL);
1801 } 1801 }