Mercurial > hg > orthanc-stone
changeset 1050:d393ad9cf68c
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Oct 2019 14:31:56 +0200 |
parents | 348866dd217c |
children | 7fad86d62135 |
files | Framework/OpenGL/WebAssemblyOpenGLContext.cpp Framework/Viewport/WebAssemblyViewport.cpp |
diffstat | 2 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/OpenGL/WebAssemblyOpenGLContext.cpp Thu Oct 10 14:29:02 2019 +0200 +++ b/Framework/OpenGL/WebAssemblyOpenGLContext.cpp Thu Oct 10 14:31:56 2019 +0200 @@ -123,14 +123,14 @@ if (IsContextLost()) { LOG(ERROR) << "MakeCurrent() called on lost context " << context_; - throw OpenGLContextLostException(reinterpret_cast<void*>(context_)); + throw StoneException(ErrorCode_WebGLContextLost); } if (emscripten_is_webgl_context_lost(context_)) { LOG(ERROR) << "OpenGL context has been lost for canvas: " << canvas_; SetLostContext(); - throw OpenGLContextLostException(reinterpret_cast<void*>(context_)); + throw StoneException(ErrorCode_WebGLContextLost); } if (emscripten_webgl_make_context_current(context_) != EMSCRIPTEN_RESULT_SUCCESS)
--- a/Framework/Viewport/WebAssemblyViewport.cpp Thu Oct 10 14:29:02 2019 +0200 +++ b/Framework/Viewport/WebAssemblyViewport.cpp Thu Oct 10 14:31:56 2019 +0200 @@ -20,6 +20,9 @@ #include "WebAssemblyViewport.h" + +#include "../StoneException.h" + #include <emscripten/html5.h> namespace OrthancStone @@ -110,11 +113,18 @@ GetCompositor()->Refresh(); } } - catch (const OpenGLContextLostException& e) + catch (const StoneException& e) { - LOG(WARNING) << "Context " << std::hex << e.context_ << " is lost! Compositor will be disabled."; - DisableCompositor(); - // we now need to wait for the "context restored" callback + if (e.GetErrorCode() == ErrorCode_WebGLContextLost) + { + LOG(WARNING) << "Context is lost! Compositor will be disabled."; + DisableCompositor(); + // we now need to wait for the "context restored" callback + } + else + { + throw; + } } catch (...) {