# HG changeset patch # User Sebastien Jodogne # Date 1570710716 -7200 # Node ID d393ad9cf68c180f1ae860fef7a1afc7705acfd6 # Parent 348866dd217c332ac8009f3c8cee62c26e695cb8 fix diff -r 348866dd217c -r d393ad9cf68c Framework/OpenGL/WebAssemblyOpenGLContext.cpp --- 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(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(context_)); + throw StoneException(ErrorCode_WebGLContextLost); } if (emscripten_webgl_make_context_current(context_) != EMSCRIPTEN_RESULT_SUCCESS) diff -r 348866dd217c -r d393ad9cf68c Framework/Viewport/WebAssemblyViewport.cpp --- 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 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 (...) {