comparison Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1622:0f8d6791b403

fix build by making the destructor of ViewerViewport public
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Nov 2020 07:04:02 +0100
parents 1151e25d7311
children 74be0f498b08
comparison
equal deleted inserted replaced
1621:575f512cdf48 1622:0f8d6791b403
1736 lock->GetController().GetScene().SetLayer(1000, layer.release()); 1736 lock->GetController().GetScene().SetLayer(1000, layer.release());
1737 lock->Invalidate(); 1737 lock->Invalidate();
1738 }*/ 1738 }*/
1739 } 1739 }
1740 1740
1741 ~ViewerViewport()
1742 {
1743 emscripten_set_wheel_callback(viewport_->GetCanvasCssSelector().c_str(), this, true, NULL);
1744 emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, NULL);
1745 emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, NULL);
1746 }
1747
1748 static EM_BOOL OnKey(int eventType, 1741 static EM_BOOL OnKey(int eventType,
1749 const EmscriptenKeyboardEvent *event, 1742 const EmscriptenKeyboardEvent *event,
1750 void *userData) 1743 void *userData)
1751 { 1744 {
1752 /** 1745 /**
1795 { 1788 {
1796 dynamic_cast<const ICommand&>(message.GetOrigin().GetPayload()).Handle(message); 1789 dynamic_cast<const ICommand&>(message.GetOrigin().GetPayload()).Handle(message);
1797 } 1790 }
1798 1791
1799 public: 1792 public:
1793 virtual ~ViewerViewport()
1794 {
1795 // Unregister the callbacks to avoid any call with a "void*" that
1796 // has been destroyed. "WebAssemblyViewport::GetObjectCookie()"
1797 // provides a more advanced alternative.
1798 emscripten_set_wheel_callback(viewport_->GetCanvasCssSelector().c_str(), this, true, 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);
1801 }
1802
1800 static boost::shared_ptr<ViewerViewport> Create(OrthancStone::ILoadersContext::ILock& lock, 1803 static boost::shared_ptr<ViewerViewport> Create(OrthancStone::ILoadersContext::ILock& lock,
1801 const OrthancStone::DicomSource& source, 1804 const OrthancStone::DicomSource& source,
1802 const std::string& canvas, 1805 const std::string& canvas,
1803 boost::shared_ptr<FramesCache> cache, 1806 boost::shared_ptr<FramesCache> cache,
1804 bool softwareRendering) 1807 bool softwareRendering)