diff Framework/OpenGL/WebAssemblyOpenGLContext.cpp @ 1483:6abd819aa534

moving edge case from WebGLViewport::UpdateSize() to WebAssemblyOpenGLContext::RefreshCanvasSize()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 20 Jun 2020 11:16:55 +0200
parents 5c96bf3f1d32
children
line wrap: on
line diff
--- a/Framework/OpenGL/WebAssemblyOpenGLContext.cpp	Sat Jun 20 11:08:28 2020 +0200
+++ b/Framework/OpenGL/WebAssemblyOpenGLContext.cpp	Sat Jun 20 11:16:55 2020 +0200
@@ -243,7 +243,23 @@
     void WebAssemblyOpenGLContext::RefreshCanvasSize()
     {
       assert(pimpl_.get() != NULL);
-      pimpl_->UpdateSize();
+
+      try
+      {
+        pimpl_->UpdateSize();
+      }
+      catch (const StoneException& e)
+      {
+        // Ignore problems about the loss of the WebGL context (edge case)
+        if (e.GetErrorCode() == ErrorCode_WebGLContextLost)
+        {
+          return;
+        }
+        else
+        {
+          throw;
+        }
+      }
     }
 
     const std::string& WebAssemblyOpenGLContext::GetCanvasSelector() const